Skip to content

AO3-7432 Fix 500 error when leaving kudos with JavaScript disabled - #5962

Open
evanwhitt wants to merge 1 commit into
otwcode:masterfrom
evanwhitt:AO3-7432-kudos-redirect-anchor
Open

AO3-7432 Fix 500 error when leaving kudos with JavaScript disabled#5962
evanwhitt wants to merge 1 commit into
otwcode:masterfrom
evanwhitt:AO3-7432-kudos-redirect-anchor

Conversation

@evanwhitt

@evanwhitt evanwhitt commented Aug 3, 2026

Copy link
Copy Markdown

Pull Request Checklist

Issue

https://otwarchive.atlassian.net/browse/AO3-7432

Purpose

Leaving kudos with JavaScript disabled can 500 if the page you're on already has an anchor in the URL (e.g. you're at the bookmark form, so the URL ends in #bookmark-form).

The kudos redirect just glued #kudos_message onto the referer URL, which gives you something like ...#bookmark-form#kudos_message. Ruby's URI parser rejects the # inside the fragment, so Rails' open redirect protection throws OpenRedirectError and you get a 500.

Fix: strip any existing anchor from the redirect target before adding #kudos_message.

Testing Instructions

Smoke test as per the Jira issue:

  1. Disable JavaScript in your browser.
  2. Go to a work.
  3. Press the Kudos button.
  4. You should be redirected to the work with #kudos_message at the end of the URL, taking you to the success or error message.
  5. Repeat while scrolled to the bookmark form (URL ends in #bookmark-form) to confirm no 500.

Credit

Evan W (he/him) [b1ume]

@evanwhitt
evanwhitt force-pushed the AO3-7432-kudos-redirect-anchor branch from 381f6b7 to af1654b Compare August 3, 2026 03:54
@evanwhitt
evanwhitt force-pushed the AO3-7432-kudos-redirect-anchor branch from af1654b to 2505ea6 Compare August 4, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant