Skip to content

AO3-6348 Fix autocomplete highlight escaping for pipe queries#5746

Open
noahbravo wants to merge 1 commit intootwcode:masterfrom
noahbravo:AO3-6348-autocomplete-pipe-highlight-fix
Open

AO3-6348 Fix autocomplete highlight escaping for pipe queries#5746
noahbravo wants to merge 1 commit intootwcode:masterfrom
noahbravo:AO3-6348-autocomplete-pipe-highlight-fix

Conversation

@noahbravo
Copy link
Copy Markdown

Pull Request Checklist

Issue

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

Purpose

Fixes an autocomplete highlighting issue where queries containing a pipe (|) can result in malformed suggestions with a stray semicolon after ampersands.

For example, typing Evil Queen | could produce:
Evil Queen | Regina Mills &; Henry Mills
instead of:
Evil Queen | Regina Mills & Henry Mills

This was caused by incomplete escaping of regex metacharacters in the autocomplete highlighting logic.

Changes made:

  • Updated regex escaping in public/javascripts/jquery.tokeninput.js to correctly escape | and other metacharacters.
  • Updated public/javascripts/jquery.tokeninput.min.js accordingly.
  • Added a JavaScript feature scenario in features/other_a/autocomplete.feature to cover this case.

Testing Instructions

Automated:

  • docker compose run --rm test bundle exec cucumber features/other_a/autocomplete.feature:264
  • docker compose run --rm test bundle exec cucumber features/other_a/autocomplete.feature

Manual:
Follow the reproduction steps in AO3-6348:
https://otwarchive.atlassian.net/browse/AO3-6348

Expected behavior:

  • Autocomplete suggestions should not include a stray semicolon after ampersands when the query contains a pipe (|).
  • The example relationship should appear as:
    Evil Queen | Regina Mills & Henry Mills
  • No regressions in other autocomplete fields.

Credit

Name: Noah Bravo
Pronouns: they/them

Copy link
Copy Markdown
Member

@brianjaustin brianjaustin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

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.

2 participants