]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
FOP-3198: Allow curly braces for src url
authorSimon Steiner <ssteiner@apache.org>
Wed, 7 Aug 2024 12:02:29 +0000 (13:02 +0100)
committerSimon Steiner <ssteiner@apache.org>
Wed, 7 Aug 2024 12:02:29 +0000 (13:02 +0100)
fop-core/src/main/java/org/apache/fop/apps/io/InternalResourceResolver.java
fop-core/src/test/java/org/apache/fop/apps/io/URIResolverWrapperTestCase.java

index 470f2e4ba7a0dd25a974f4ecae19630767003585..1fe530bd390eb19718aa54d920daba80b59cf7e3 100644 (file)
@@ -133,6 +133,8 @@ public class InternalResourceResolver {
         }
         String fixedUri = uriStr.replace('\\', '/');
         fixedUri = fixedUri.replace(" ", "%20");
+        fixedUri = fixedUri.replace("{", "%7B");
+        fixedUri = fixedUri.replace("}", "%7D");
         URI baseURI = new URI(fixedUri);
         return baseURI;
     }
index 5bab320f68ccb1149174e392d1e2a07ceef0a3b6..ffb477a73f66ea8ca459493dec289b7a68e2239f 100644 (file)
@@ -120,6 +120,11 @@ public class URIResolverWrapperTestCase {
         assertNull(InternalResourceResolver.cleanURI(null));
     }
 
+    @Test
+    public void testCurlyBrackets() throws Exception {
+        assertEquals(InternalResourceResolver.cleanURI("{test}.jpg"), new URI("%7Btest%7D.jpg"));
+    }
+
     private void test(String uriStr, URI uri, URI expected) throws IOException, URISyntaxException {
         ResourceResolver resolver = mock(ResourceResolver.class);
         InternalResourceResolver sut = new InternalResourceResolver(base, resolver);