You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2024/08/07 12:02:43 UTC
(xmlgraphics-fop) branch main updated: FOP-3198: Allow curly braces for src url
This is an automated email from the ASF dual-hosted git repository.
ssteiner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-fop.git
The following commit(s) were added to refs/heads/main by this push:
new c11f43c9d FOP-3198: Allow curly braces for src url
c11f43c9d is described below
commit c11f43c9dbf529b87820d77ef501aa10699fc9d8
Author: Simon Steiner <ss...@apache.org>
AuthorDate: Wed Aug 7 13:02:29 2024 +0100
FOP-3198: Allow curly braces for src url
---
.../main/java/org/apache/fop/apps/io/InternalResourceResolver.java | 2 ++
.../test/java/org/apache/fop/apps/io/URIResolverWrapperTestCase.java | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/fop-core/src/main/java/org/apache/fop/apps/io/InternalResourceResolver.java b/fop-core/src/main/java/org/apache/fop/apps/io/InternalResourceResolver.java
index 470f2e4ba..1fe530bd3 100644
--- a/fop-core/src/main/java/org/apache/fop/apps/io/InternalResourceResolver.java
+++ b/fop-core/src/main/java/org/apache/fop/apps/io/InternalResourceResolver.java
@@ -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;
}
diff --git a/fop-core/src/test/java/org/apache/fop/apps/io/URIResolverWrapperTestCase.java b/fop-core/src/test/java/org/apache/fop/apps/io/URIResolverWrapperTestCase.java
index 5bab320f6..ffb477a73 100644
--- a/fop-core/src/test/java/org/apache/fop/apps/io/URIResolverWrapperTestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/apps/io/URIResolverWrapperTestCase.java
@@ -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);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org