Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve URL equality #453

Merged
merged 2 commits into from
Jun 11, 2024
Merged

Improve URL equality #453

merged 2 commits into from
Jun 11, 2024

Conversation

mickael-menu
Copy link
Member

Instead of comparing URL to their string representation, compare their components with different rules:

  • Scheme is case insensitive.
  • Paths must be compared percent-decoded.
  • Authority, fragment and query parameters must match.

The reason for this change is that some EPUBs encode unreserved characters which breaks locating a Link from an HREF.

For example both of these are valid relative URLs which point to the same resource:

  • Text/Ces_choses_qu'on_laisse.xhtml
  • Text/Ces_choses_qu%27on_laisse.xhtml

@mickael-menu mickael-menu merged commit 91bc159 into develop Jun 11, 2024
6 checks passed
@mickael-menu mickael-menu deleted the fix/url-equality branch June 11, 2024 14:52
mickael-menu added a commit to demarque/readium-swift-toolkit that referenced this pull request Jun 11, 2024
mickael-menu added a commit that referenced this pull request Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant