hypothesis / hypothesis/product-backlog
Issue with handling of percent-encoded characters in URL (?)
- Dominant language
- No language data
- Stars
- 122
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
_(robertknight's edit - 2018-01-27): I don't think the issue has anything to do with username changes. See https://github.com/hypothesis/product-backlog/issues/443#issuecomment-360946665 below_:
I got example links back that do and do not work - they were on different URLs. The example link that did not work was on this URL: https://flipboard.com/article/why-this-award-winning-psychologist-says-you-should-throw-out-everything-you-kno/f-2af8d2b1ed%2Finc.com . Note the "%2F" at the end and from an initial look, it appears that the problem may relate to this.
When the client fetched annotations, it made a query that was roughly https://hypothes.is/api/search?uri=https%3A%2F%2Fflipboard.com%2Farticle%2Fwhy-this-award-winning-psychologist-says-you-should-throw-out-everything-you-kno%2Ff-2af8d2b1ed%2Finc.com . If you run the "uri" param through decodeURIComponent you'll get https://flipboard.com/article/why-this-award-winning-psychologist-says-you-should-throw-out-everything-you-kno/f-2af8d2b1ed/inc.com (note the "/" slash instead of "%2F" at the end).
The search logic will treat the two variants of the URL (with "%2F" vs "/" near the end) as different and if the client was fetching one variant but the annotations had been associated with the other, this would explain why they did not appear.
I have not yet found the conditions that cause the client to set the uri field to the "%2F" variant when creating an annotation. When I created annotations locally, the "uri" field of new annotations was always set to "/".
---
From Zendesk: https://hypothesis.zendesk.com/agent/tickets/2120
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the mismatch at the /api/search endpoint with the Flipboard URL, comparing the encoded "%2F" form with the decoded slash form. Trace how the client creates annotations and how search compares the uri values. Done means the cause is identified and the two URL variants are handled consistently, with a regression test if the relevant test location is found.
Written by the indexing model from the issue text.
Assessment
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100