diff --git a/src/main/java/com/adobe/epubcheck/ocf/OCFContainer.java b/src/main/java/com/adobe/epubcheck/ocf/OCFContainer.java index ebaf4d087..554d3f2e8 100644 --- a/src/main/java/com/adobe/epubcheck/ocf/OCFContainer.java +++ b/src/main/java/com/adobe/epubcheck/ocf/OCFContainer.java @@ -131,7 +131,7 @@ public String relativize(URL url) public boolean isRemote(URL url) { Preconditions.checkArgument(url != null, "URL is null"); - if (contains(url)) + if (!url.isHierarchical() || contains(url)) { return false; } diff --git a/src/main/java/org/w3c/epubcheck/core/references/ReferenceRegistry.java b/src/main/java/org/w3c/epubcheck/core/references/ReferenceRegistry.java index 7c7662d06..1e36ff211 100644 --- a/src/main/java/org/w3c/epubcheck/core/references/ReferenceRegistry.java +++ b/src/main/java/org/w3c/epubcheck/core/references/ReferenceRegistry.java @@ -49,7 +49,10 @@ public void registerReference(URL url, Type type, EPUBLocation location, if (url == null) return; // Remove query component of local URLs - if (url.query() != null && !container.isRemote(url)) + // Note: we only do this for hierarchical URLs, to work around a bug + // in Galimatias that would transform a non-hierarchical URL into a + // hierarchical one. Queries for data URLs can safely be ignored here. + if (url.isHierarchical() && url.query() != null && !container.isRemote(url)) { try { diff --git a/src/test/resources/epub3/03-resources/files/data-url-with-unescaped-query-valid/EPUB/content_001.xhtml b/src/test/resources/epub3/03-resources/files/data-url-with-unescaped-query-valid/EPUB/content_001.xhtml new file mode 100644 index 000000000..5ad0c107d --- /dev/null +++ b/src/test/resources/epub3/03-resources/files/data-url-with-unescaped-query-valid/EPUB/content_001.xhtml @@ -0,0 +1,13 @@ + + +
+ +Call me Ishmael.
+ + + diff --git a/src/test/resources/epub3/03-resources/files/data-url-with-unescaped-query-valid/EPUB/nav.xhtml b/src/test/resources/epub3/03-resources/files/data-url-with-unescaped-query-valid/EPUB/nav.xhtml new file mode 100644 index 000000000..240745e63 --- /dev/null +++ b/src/test/resources/epub3/03-resources/files/data-url-with-unescaped-query-valid/EPUB/nav.xhtml @@ -0,0 +1,14 @@ + + + + +