thegetty/quire

EPUB figure images with the same filename must all get unique IDs in package.opf manifest

Closed this issue · 3 comments

Before proceeding, check to make sure there isn’t an existing issue for this bug.

  • I have searched the existing issues and determined this is a new bug.

Steps to reproduce

  1. Start a new Quire project
  2. Run quire build and then quire epub to create the EPUB file
  3. Run the EPUB through epubcheck with java -jar path/to/epubcheck.jar patt/to/epubjs.epub

Actual behavior

With the default starter, there are three <items> that end up with duplicate IDs in the package.opf file and so cause a validation error. They are all print-image.jpg files, and the IDs seem to be generated solely off the filename and so end up identical. I think the IDs need to be generated some other way. I think best if they included their paths so something like iiif/cat-1/lange-mother-a/print-image.jpg would become id='id_iiif_cat-1_lange-mother-a_print-image-jpg` instead of just id="id_print-image", thus ensuring that these will always be unique.

Expected behavior

All supplied resources would be given unique IDs to pass EPUB validation.

Version numbers

quire-cli 1.0.0-rc.6
quire-11ty 1.0.0-rc.8
node 18.12.1

What browsers are you seeing the problem on?

No response

Relevant Terminal/Shell output

No response

Supporting Information

No response

Updated the id generation in epub.js to use the full url, will be included in the next release.

@fchasen the change made to avoid duplicate IDs seems to have done the trick as far as validation, but the resulting IDs are rather bonkers and are including the full local filepath which feels a little weird.

Not a bug per se, but I wanted to bring it to your attention. Perhaps there's something to be done to clean it up a bit?

  <manifest>
    <item id="id_file--3A--2F--2F--2FUsers--2Fgalbers--2Ftest-epub-latest--2F_epub--2F01_pdf-epub-half-title.xhtml" href="01_pdf-epub-half-title.xhtml" media-type="application/xhtml+xml" />
    <item id="id_file--3A--2F--2F--2FUsers--2Fgalbers--2Ftest-epub-latest--2F_epub--2F02_pdf-epub-title.xhtml" href="02_pdf-epub-title.xhtml" media-type="application/xhtml+xml" />
    <item id="id_file--3A--2F--2F--2FUsers--2Fgalbers--2Ftest-epub-latest--2F_epub--2F04_contents.xhtml" href="04_contents.xhtml" media-type="application/xhtml+xml" properties="nav" />
    <item id="id_file--3A--2F--2F--2FUsers--2Fgalbers--2Ftest-epub-latest--2F_epub--2F07_catalogue.xhtml" href="07_catalogue.xhtml" media-type="application/xhtml+xml" />
    <item id="id_file--3A--2F--2F--2FUsers--2Fgalbers--2Ftest-epub-latest--2F_epub--2F11_contributors.xhtml" href="11_contributors.xhtml" media-type="application/xhtml+xml" />
...

That is pretty concerning! We are using file urls for this so I guess when we resolved the files it got the whole path.

I removed that id generation change, and updated to using filenames again but incrementing any repeats in epubjs-cli@0.1.5.