diff --git a/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java b/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java
index 38fafbd0..b950fe4c 100644
--- a/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java
+++ b/engines/base/src/main/java/org/alfresco/transform/base/fs/FileManager.java
@@ -43,7 +43,6 @@ import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
-import java.net.URL;
import java.nio.file.Files;
import java.util.UUID;
import jakarta.servlet.http.HttpServletRequest;
@@ -193,21 +192,23 @@ public class FileManager
{
try
{
- URL url = new URL(directUrl);
- String protocol = url.getProtocol();
+ // Parse without re-encoding so pre-signed URL query strings (e.g. S3/Azure) are
+ // forwarded verbatim. The 7-arg URI constructor would percent-encode the query,
+ // turning '%' into '%25' and invalidating any pre-computed signature (ACS-12053).
+ URI uri = new URI(directUrl);
+ String protocol = uri.getScheme();
if ("http".equalsIgnoreCase(protocol) || "https".equalsIgnoreCase(protocol))
{
- String host = url.getHost();
+ String host = uri.getHost();
if (host == null || !host.matches("[A-Za-z0-9._\\-]+"))
{
throw new TransformException(BAD_REQUEST, "Direct Access Url host is not allowed.");
}
- return new URI(protocol, null, host, url.getPort(),
- url.getPath(), url.getQuery(), null).toURL().openStream();
+ return uri.toURL().openStream();
}
if ("file".equalsIgnoreCase(protocol))
{
- File localFile = assertWithinTempDir(new File(url.toURI()));
+ File localFile = assertWithinTempDir(new File(uri));
return Files.newInputStream(localFile.toPath());
}
throw new TransformException(BAD_REQUEST, "Direct Access Url protocol is not allowed.");
diff --git a/engines/base/src/test/java/org/alfresco/transform/base/fs/FileManagerTest.java b/engines/base/src/test/java/org/alfresco/transform/base/fs/FileManagerTest.java
new file mode 100644
index 00000000..75e7cbf5
--- /dev/null
+++ b/engines/base/src/test/java/org/alfresco/transform/base/fs/FileManagerTest.java
@@ -0,0 +1,126 @@
+/*
+ * #%L
+ * Alfresco Transform Core
+ * %%
+ * Copyright (C) 2005 - 2026 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * -
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ * -
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ * -
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ * -
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see
+ * In particular guards against ACS-12053 (double percent-encoding of the
+ * direct-access URL's query string), which broke S3/Azure pre-signed URLs
+ * because the rebuilt URL no longer matched the original signature.
+ */
+class FileManagerTest
+{
+ private HttpServer server;
+ private final AtomicReference