diff --git a/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java b/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java index 77e104c66..9fc249562 100644 --- a/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java +++ b/src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java @@ -412,10 +412,10 @@ private void checkLinkedResources() LinkedResources links = ((OPFHandler30) opfHandler).getLinkedResources(); for (LinkedResource link : links.asList()) { - if (opfHandler.getItemByURL(link.getDocumentURL()).isPresent()) + Optional item = opfHandler.getItemByURL(link.getDocumentURL()); + if (item.isPresent() && !item.get().isInSpine()) { - // FIXME 2022 check how to report the URL - report.message(MessageId.OPF_067, EPUBLocation.of(context), link.getDocumentURL().path()); + report.message(MessageId.OPF_067, EPUBLocation.of(context), item.get().getPath()); } } } diff --git a/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/EPUB/content_001.xhtml b/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/EPUB/content_001.xhtml new file mode 100644 index 000000000..3304c26e9 --- /dev/null +++ b/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/EPUB/content_001.xhtml @@ -0,0 +1,18 @@ + + + + + Minimal EPUB + + + +

Loomings

+

Call me Ishmael.

+ + diff --git a/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/EPUB/nav.xhtml b/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/EPUB/nav.xhtml new file mode 100644 index 000000000..240745e63 --- /dev/null +++ b/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/EPUB/nav.xhtml @@ -0,0 +1,14 @@ + + + + + Minimal Nav + + + + + diff --git a/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/EPUB/package.opf b/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/EPUB/package.opf new file mode 100644 index 000000000..955cc04e4 --- /dev/null +++ b/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/EPUB/package.opf @@ -0,0 +1,18 @@ + + + + Minimal EPUB 3.0 + en + NOID + 2017-06-14T00:00:01Z + + + + + + + + + + diff --git a/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/META-INF/container.xml b/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/META-INF/container.xml new file mode 100644 index 000000000..318782179 --- /dev/null +++ b/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/META-INF/container.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/mimetype b/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/mimetype new file mode 100644 index 000000000..57ef03f24 --- /dev/null +++ b/src/test/resources/epub3/05-package-document/files/link-to-embedded-resource-valid/mimetype @@ -0,0 +1 @@ +application/epub+zip \ No newline at end of file diff --git a/src/test/resources/epub3/05-package-document/files/link-to-publication-resource-error.opf b/src/test/resources/epub3/05-package-document/files/link-to-spine-item-valid.opf similarity index 79% rename from src/test/resources/epub3/05-package-document/files/link-to-publication-resource-error.opf rename to src/test/resources/epub3/05-package-document/files/link-to-spine-item-valid.opf index 0430ba6cf..bbd9f6914 100644 --- a/src/test/resources/epub3/05-package-document/files/link-to-publication-resource-error.opf +++ b/src/test/resources/epub3/05-package-document/files/link-to-spine-item-valid.opf @@ -7,8 +7,7 @@ en NOID 2019-01-01T12:00:00Z - - + diff --git a/src/test/resources/epub3/05-package-document/package-document.feature b/src/test/resources/epub3/05-package-document/package-document.feature index 4b3b72216..46810f114 100644 --- a/src/test/resources/epub3/05-package-document/package-document.feature +++ b/src/test/resources/epub3/05-package-document/package-document.feature @@ -382,6 +382,16 @@ Feature: EPUB 3 — Package document When checking file 'link-hreflang-not-well-formed-error.opf' Then error OPF-092 is reported And no other errors or warnings are reported + + @spec @xref:sec-link-elem + Scenario: Allow a link to a resource referenced from the spine + When checking file 'link-to-spine-item-valid.opf' + Then no errors or warnings are reported + + @spec @xref:sec-link-elem + Scenario: Allow a link to a resource embedded in a content document + When checking EPUB 'link-to-embedded-resource-valid' + Then no errors or warnings are reported ### 5.6 Manifest section