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

fix: resolve relative URIs against their base #955

Merged
merged 1 commit into from
Jan 22, 2019

Conversation

rdeltour
Copy link
Member

  • re-implement the PathUtil class to fix various URI resolution issues
  • remove the 3-arg resolveRelativeReference method
  • systematically resolve URI references in Content Documents against the
    base URI
  • the base URI is initially set to the document path, and overriden with
    xml:base attributes or HTML’s base element
  • add more exhaustive tests for URI normalization/resolution logic

What this PR doesn’t do:

  • cleanup the many uses of paths strings, where we should really use URIs.
    The PathUtil code is mostly a hack, when we should rely on more robust
    URI normalization/resolution logic from URIs.
  • implement proper base resolution logic (xml:base should be deprecated,
    and only the first base element should be taken into account).
    See also xml:base attribute epub-specs#1217.

Fixes #527

@rdeltour rdeltour added the status: needs review Needs to be reviewed by a team member before further processing label Jan 22, 2019
@rdeltour rdeltour added this to the 4.1.1 milestone Jan 22, 2019
- re-implement the `PathUtil` class to fix various URI resolution issues
- remove the 3-arg `resolveRelativeReference` method
- systematically resolve URI references in Content Documents against the
  base URI
- the base URI is initially set to the document path, and overriden with
  `xml:base` attributes or HTML’s `base` element
- add more exhaustive tests for URI normalization/resolution logic

What this PR doesn’t do:

- cleanup the many uses of paths strings, where we should really use URIs.
  The `PathUtil` code is mostly a hack, when we should rely on more robust
  URI normalization/resolution logic from URIs.
- implement proper base resolution logic (`xml:base` should be deprecated,
  and only the first `base` element should be taken into account).
  See also w3c/epub-specs#1217.

Fixes #527
@rdeltour rdeltour merged commit d42ccd6 into master Jan 22, 2019
@rdeltour rdeltour deleted the fix/issue-527/base-uri branch January 22, 2019 09:17
@rdeltour rdeltour added status: completed Work completed, can be closed and removed status: needs review Needs to be reviewed by a team member before further processing labels Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: completed Work completed, can be closed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem parsing relative URLs
1 participant