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

Problem parsing relative URLs #527

Closed
mebibou opened this issue Apr 14, 2015 · 5 comments · Fixed by #955
Closed

Problem parsing relative URLs #527

mebibou opened this issue Apr 14, 2015 · 5 comments · Fixed by #955
Assignees
Labels
status: has PR The issue is being processed in a pull request type: bug The issue describes a bug
Milestone

Comments

@mebibou
Copy link

mebibou commented Apr 14, 2015

When using relative URLs for resources in html files, epubcheck complains about Invalid path. Example:

OEBPS/test/index.html

<html>
  <base href="./">
  <link href="../css/test.css" />
</html>
<body>
</body>

OEBPS/css/test.css

body {
 width: 100%;
}

When epubcheck parses the file OEBPS/test/index.html, the following error will show up:
ERROR: test.epub: could not parse OEBPS/test/index.html: Invalid path: ./../css/test.css.

If I change the base to: <base href="./test/"> then there is no error but when loading the epub in a reader it cannot find the test.css file

@tofi86 tofi86 added the type: bug The issue describes a bug label Jan 2, 2017
@tofi86 tofi86 added the status: needs review Needs to be reviewed by a team member before further processing label Sep 28, 2017
@rdeltour
Copy link
Member

Hi @mebibou. Sorry for looking only now into this old issue…
Unfortunately I wasn't able to reproduce, neither for with EPUB 2.0 or EPUB 3.

If you still face the issue, could you possibly send a sample?

@rdeltour rdeltour added status: waiting for feedback The development team needs feedback from the issue’s creator and removed type: bug The issue describes a bug status: needs review Needs to be reviewed by a team member before further processing labels Jan 20, 2019
@rdeltour rdeltour self-assigned this Jan 20, 2019
@rdeltour rdeltour added the type: unverified The issue couldn't be reproduced label Jan 20, 2019
@mebibou
Copy link
Author

mebibou commented Jan 21, 2019

sorry not on this project anymore

@rdeltour
Copy link
Member

ok, thanks for answering! I'll close as invalid. Anyone can comment or reopen if they face the same issue.

@rdeltour rdeltour added type: not an issue The issue is rejected (not an actual issue or not relevant) and removed status: waiting for feedback The development team needs feedback from the issue’s creator type: unverified The issue couldn't be reproduced labels Jan 21, 2019
@mattgarrish
Copy link
Member

I'm finding the base tag really messes up epubcheck. If I add in <base href="./"/> to a file, then it complains that each referenced resource could not be found in the EPUB.

If I do a little more silliness and go up and down a level - <base href="../EPUB/"/> - then I get the error about invalid paths.

@mattgarrish mattgarrish reopened this Jan 21, 2019
@rdeltour
Copy link
Member

Oh. I tried harder and was able to reproduce. I'm wondering what the heck I missed earlier. 🤔

Thanks @mattgarrish for double-checking! I'll dig deeper now…

@rdeltour rdeltour added type: bug The issue describes a bug status: in progress The issue is being implemented by the development team and removed type: not an issue The issue is rejected (not an actual issue or not relevant) labels Jan 21, 2019
@rdeltour rdeltour added this to the 4.1.1 milestone Jan 21, 2019
rdeltour added a commit that referenced this issue 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 added status: has PR The issue is being processed in a pull request and removed status: in progress The issue is being implemented by the development team labels Jan 22, 2019
rdeltour added a commit that referenced this issue 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 added a commit that referenced this issue 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: has PR The issue is being processed in a pull request type: bug The issue describes a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants