Attempt to fix issues #531 and #5202, annotation error due to URI encoding error
Implemented a change to the HTMLMetadata class in html-metadata.ts to address a URI encoding issue that prevented annotations from being made.
Specifically, the URI decoding process is now wrapped in a try-catch block. If URIError is caught, the original encoded URI is used instead and the error is logged using console.error.
This way URIs that previously were successfully decoded will be unaffected and existing annotations do not go missing.
Have not run into any issues by not decoding the URI, and seems to work for the pages mentioned in issues #5202 and #531.
Is there maybe a better approach or some edge case that will cause this approach to fail?
Thank you for reviewing. I'll review the initial reasons for URL decoding to ensure we don't introduce side effects. Also, I agree that extra tests would be beneficial for this scenario. I'll add those to the pull request.
Codecov Report
Attention: 1 lines in your changes are missing coverage. Please review.
Comparison is base (
0d31f7c) 99.44% compared to head (881fcc3) 99.43%. Report is 1 commits behind head on main.
:exclamation: Current head 881fcc3 differs from pull request most recent head d02d718. Consider uploading reports for the commit d02d718 to get more accurate results
| Files | Patch % | Lines |
|---|---|---|
| src/annotator/integrations/html-metadata.ts | 80.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## main #6152 +/- ##
==========================================
- Coverage 99.44% 99.43% -0.02%
==========================================
Files 266 263 -3
Lines 10130 10102 -28
Branches 2401 2412 +11
==========================================
- Hits 10074 10045 -29
- Misses 56 57 +1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Thanks @tom-pj!
Just to avoid bothering you again and understanding you are not used to our usual workflows and the project tools, I have taken the liberty to squash the commits, rebase from
main, fix the code format and push to your branch.This si good to merge as soon as CI is green.
This is my first open source contribution on GitHub, thank you for helping me out!