Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent some internal URLs from leaking in messages #1584

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading