You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "Erik Hofer (Jira)" <ji...@apache.org> on 2020/10/05 15:58:00 UTC

[jira] [Created] (FOP-2973) Cannot use custom schemes starting with "data" in resource resolving

Erik Hofer created FOP-2973:
-------------------------------

             Summary: Cannot use custom schemes starting with "data" in resource resolving
                 Key: FOP-2973
                 URL: https://issues.apache.org/jira/browse/FOP-2973
             Project: FOP
          Issue Type: Bug
    Affects Versions: 2.5
            Reporter: Erik Hofer


In {{org.apache.fop.apps.io.InternalResourceResolver}} there is the following code:
{code:java}
    public Resource getResource(URI uri) throws IOException {
        if (uri.getScheme() != null && uri.getScheme().startsWith("data")) {
            return new Resource(resolveDataURI(uri.toASCIIString()));
        }
        return resourceResolver.getResource(resolveFromBase(uri));
    }
{code}
All URIs with a scheme _starting with_ "data" are treated as a data URI. This means schemes like "dataFoo" are not delegated to the {{resourceResolver}}. I think this should be {{equals}} instead.

The string overload works correctly because it includes the colon:

{code:java}
  public Resource getResource(String stringUri) throws IOException, URISyntaxException {
        if (stringUri.startsWith("data:")) {
            return new Resource(resolveDataURI(stringUri));
        }
        return getResource(cleanURI(stringUri));
    }
{code}




--
This message was sent by Atlassian Jira
(v8.3.4#803005)