From fe9c781112188dbc5c8bca6408a6b146a7205f82 Mon Sep 17 00:00:00 2001 From: Sharon Luong Date: Tue, 14 Nov 2023 16:26:45 -0500 Subject: [PATCH] BXC-3284 fix path with URL encoding --- .../web/services/processing/ImageServerProxyService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web-services-app/src/main/java/edu/unc/lib/boxc/web/services/processing/ImageServerProxyService.java b/web-services-app/src/main/java/edu/unc/lib/boxc/web/services/processing/ImageServerProxyService.java index 87e997ead6..c9b48cd53d 100644 --- a/web-services-app/src/main/java/edu/unc/lib/boxc/web/services/processing/ImageServerProxyService.java +++ b/web-services-app/src/main/java/edu/unc/lib/boxc/web/services/processing/ImageServerProxyService.java @@ -4,6 +4,8 @@ import java.io.OutputStream; import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import javax.servlet.http.HttpServletResponse; @@ -55,9 +57,10 @@ public void setHttpClientConnectionManager(HttpClientConnectionManager manager) public void getMetadata(String id, OutputStream outStream, HttpServletResponse response, int retryServerError) { + var idPathEncoded = URLEncoder.encode(idToPath(id, 4, 2), StandardCharsets.UTF_8); + var idEncoded = URLEncoder.encode(id, StandardCharsets.UTF_8); StringBuilder path = new StringBuilder(getImageServerProxyBasePath()); - path.append(idToPath(id, 4, 2)) - .append(id).append(".jp2").append("/info.json"); + path.append(idPathEncoded).append(idEncoded).append(".jp2").append("/info.json"); int statusCode = -1; String statusLine = null;