Skip to content

Conversation

rdeltour
Copy link
Member

A NullPointerException was raised on data URLs ending with a query-like string.
This was caused by a double-bug in Galimatias:

  • removing the query-like string (as we do when registering references) with URL#withQuery(null) resulted in a hierarchical URL despite data URLs being non-hierarchical.
  • such hybrid data URLs caused an NPE to be raised when canonicalized

We now add some check to not remove the query component on non-hierarchical URLs.

Also, OCFContainer#isRemote(URL) now returns false without further checks for data URLs.

Fixes #1536

A NullPointerException was raised on `data` URLs ending with a query-like
string.
This was caused by a double-bug in Galimatias:
- removing the query-like string (as we do when registering references)
  with `URL#withQuery(null)` resulted in a hierarchical URL despite
  `data` URLs being non-hierarchical.
- such hybrid `data` URLs caused an NPE to be raised when canonicalized

We now add some check to not remove the query component on non-hierarchical
URLs.

Also, `OCFContainer#isRemote(URL)` now returns false without further checks
for `data` URLs.

Fixes #1536
@rdeltour rdeltour added the status: ready to merge The pull request is ready to be merged label Dec 23, 2024
@rdeltour rdeltour added this to the Next maintenance release milestone Dec 23, 2024
@rdeltour rdeltour self-assigned this Dec 23, 2024
Base automatically changed from fix/1538/css-custom-prop to main December 29, 2024 00:00
@rdeltour rdeltour merged commit c50536d into main Dec 29, 2024
5 checks passed
@rdeltour rdeltour deleted the fix/1536/data-url-npe branch December 29, 2024 00:00
rdeltour added a commit that referenced this pull request Jan 10, 2025
Fix a regression bug introduced in PR #1582, in the implementatiom of
`OCFContainer#isRemote(URL)`.
The buggy implementation considered `mailto` URLs as local URLs. As a
result, it reported an error as no matching local resource could be
found in the container.

The new implementation says a URL is remote when it is not a `data`
URL and is not the URL of a resource in the container.

Fix #1595
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready to merge The pull request is ready to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Null exception on checking data URL - EpubCheck 5.0.1 and 5.1.0
1 participant