Skip to content

Commit

Permalink
fix: prevent some internal URLs from leaking in messages
Browse files Browse the repository at this point in the history
Fix #1542
  • Loading branch information
rdeltour committed Dec 23, 2024
1 parent 623f5ad commit e1871e2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
7 changes: 3 additions & 4 deletions src/main/java/com/adobe/epubcheck/opf/OPFChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -163,19 +163,18 @@ protected void checkGuide()
Optional<OPFItem> item = opfHandler.getItemByURL(ref.getDocumentURL());
if (!item.isPresent())
{
// FIXME 2022 check how to report URL
report.message(MessageId.OPF_031,
EPUBLocation.of(context).at(ref.getLineNumber(), ref.getColumnNumber()), ref.getURL());
EPUBLocation.of(context).at(ref.getLineNumber(), ref.getColumnNumber()),
context.relativize(ref.getURL()));
}
else
{
if (!isBlessedItemType(item.get().getMimeType(), version)
&& !isDeprecatedBlessedItemType(item.get().getMimeType()))
{
// FIXME 2022 check how to report URL
report.message(MessageId.OPF_032,
EPUBLocation.of(context).at(ref.getLineNumber(), ref.getColumnNumber()),
ref.getURL());
context.relativize(ref.getURL()));
}
}
}
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/com/adobe/epubcheck/opf/OPFChecker30.java
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,8 @@ private void checkDictCollection(ResourceCollection collection)
Optional<OPFItem> item = opfHandler.getItemByURL(resource.getDocumentURL());
if (!item.isPresent())
{
// FIXME 2022 check how to report the URL
report.message(MessageId.OPF_081, EPUBLocation.of(context),
resource.getDocumentURL().path());
context.relativize(resource.getDocumentURL()));
}
else if ("application/vnd.epub.search-key-map+xml".equals(item.get().getMimeType()))
{
Expand All @@ -317,9 +316,8 @@ else if ("application/vnd.epub.search-key-map+xml".equals(item.get().getMimeType
}
else if (!"application/xhtml+xml".equals(item.get().getMimeType()))
{
// FIXME 2022 check how to report the URL
report.message(MessageId.OPF_084, EPUBLocation.of(context),
resource.getDocumentURL().path());
context.relativize(resource.getDocumentURL()));
}
}
if (!skmFound)
Expand Down

0 comments on commit e1871e2

Please sign in to comment.