]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fix for file: URL handling. The condition for adding a leading slash was wrong.
authorJeremias Maerki <jeremias@apache.org>
Thu, 10 Nov 2005 14:27:34 +0000 (14:27 +0000)
committerJeremias Maerki <jeremias@apache.org>
Thu, 10 Nov 2005 14:27:34 +0000 (14:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@332298 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/apps/FOURIResolver.java

index a2b70346f838381dbcf3ac7c6f8dad3d26fcd910..5a72e2d12a7075768231d27f45cf4a6ded835715 100644 (file)
@@ -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);