forked from julien-c/epub
-
Notifications
You must be signed in to change notification settings - Fork 0
Either don't mutate Manifest ID and href or simplify the mutation. #6
Copy link
Copy link
Open
Description
Background
The href and sometimes the ID directly reflects a filepath. One issue with this is that filenames aren't always URL safe. Since this is being used in the web, it should be web-safe. However, I consider the current implementation being excessively complex and overstepping some bounds (the unwanted behavior).
Current solution to mitigate the above.
- During parsing, the element IDs with periods are replaced with underscore.
- When getting content, extensions and sub paths are removed as well doing step 1 again.
Example issues
- In the sister project, I am using the id as dynamic routes. One issue with this is that setting the url to have a file extension would result in the browser/server attempting to find that resource (E.g. An id "chapter1.html" will be fetched). Even though that it is url safe
- May result into unwanted behavior such as Epubs may contain all chapter data inside a body.xhtml #2, Epub 2.0's ncx filename/manifest ID may not exactly be "ncx" #5.
New solution
Simply URL-encode element IDs, HREFs, and anchor tags.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels