From: Jeremias Maerki Date: Thu, 10 Nov 2005 14:27:34 +0000 (+0000) Subject: Fix for file: URL handling. The condition for adding a leading slash was wrong. X-Git-Tag: fop-0_90-alpha1~65 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d5b1a063526e5560af3ab579974f1238a08525e0;p=xmlgraphics-fop.git Fix for file: URL handling. The condition for adding a leading slash was wrong. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@332298 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/apps/FOURIResolver.java b/src/java/org/apache/fop/apps/FOURIResolver.java index a2b70346f..5a72e2d12 100644 --- a/src/java/org/apache/fop/apps/FOURIResolver.java +++ b/src/java/org/apache/fop/apps/FOURIResolver.java @@ -110,8 +110,12 @@ public class FOURIResolver String scheme = baseURL.getProtocol() + ":"; if (href.startsWith(scheme)) { href = href.substring(scheme.length()); - if ("file:".equals(scheme) && href.indexOf(':') >= 0) { - href = "/" + href; //Absolute file URL doesn't have a leading slash + if ("file:".equals(scheme)) { + int colonPos = href.indexOf(':'); + int slashPos = href.indexOf('/'); + if (slashPos >= 0 && colonPos >= 0 && colonPos < slashPos) { + href = "/" + href; //Absolute file URL doesn't have a leading slash + } } } absoluteURL = new URL(baseURL, href);