jiegillet · GitHub

Bug description

While trying to update our app to Unpoly 3 from 2.7.2, we ran into an issue with unpoly-migrate.

At some point in our app, we have targets of the form form[action="/example?param[]=a&param[]=b"]. The regexp pattern in up.migrate.resolveOrigin is not able to deal with the nested square brackets, and it finds two matches [action="/example?param[] and &.
The second match is interpreted as an origin pseudo selector and when no origin is specified an error is thrown.

Reproduction project

Here is a reproduction project.

Steps to reproduce the behavior:

  1. Go to reproduction project linked above
  2. Click on 'Submit'
  3. Notice the error in the console

Expected behavior

No error, the & in the target should not be recognized as an origin shorthand.

Browser version

  • OS: macOS
  • Browser: Firefox
  • Version: 112

Additional context

  • We could circumvent the issue by assigning an id to the form.
  • There is only an issue with the migration script, not unpoly 3

Read the original on github.com ↗