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

Unescape URLs in EPUB 2 NCX and EPUB 3 navigation documents #97

Closed
vers-one opened this issue May 26, 2023 · 0 comments · Fixed by #98
Closed

Unescape URLs in EPUB 2 NCX and EPUB 3 navigation documents #97

vers-one opened this issue May 26, 2023 · 0 comments · Fixed by #98
Assignees
Milestone

Comments

@vers-one
Copy link
Owner

Description

When EpubReader encounters an escaped URL in <ncx>/<navMap>/<navPoint>/<content>/src attribute in EPUB 2 NCX or <a>/href attribute in EPUB 3 navigation document, it converts it into an unescaped representation. However, this happens only at the second parsing stage when an instance of Epub2Ncx or Epub3NavDocument gets converted into a List<EpubNavigationItemRef>:

string source = Uri.UnescapeDataString(navigationPoint.Content.Source);
and
string href = Uri.UnescapeDataString(navAnchor.Href);

Applications using Epub2Ncx or Epub3NavDocument types directly have to unescape the URLs manually.

Proposed solution

Move URL unescaping into Epub2NcxReader and Epub3NavDocumentReader to make sure that instances of Epub2Ncx and Epub3NavDocument types contain unescaped URLs.

Additional context

RFC 2396 - URI Escape Sequences: https://www.rfc-editor.org/rfc/rfc2396#section-2.4

@vers-one vers-one added this to the 3.3.2 milestone May 26, 2023
@vers-one vers-one self-assigned this May 26, 2023
@vers-one vers-one changed the title Unescape URLs from EPUB 2 NCX and EPUB 3 navigation documents Unescape URLs in EPUB 2 NCX and EPUB 3 navigation documents May 27, 2023
@vers-one vers-one linked a pull request May 27, 2023 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant