Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Url decode the resourceId supplied to store.getResourceInternal to fix filenames containing spaces. #8581

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions core/src/main/java/org/fao/geonet/util/XslUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.fao.geonet.ApplicationContextHolder;
import org.fao.geonet.Constants;
import org.fao.geonet.SystemInfo;
import org.fao.geonet.analytics.WebAnalyticsConfiguration;
import org.fao.geonet.api.records.attachments.FilesystemStore;
import org.fao.geonet.api.records.attachments.FilesystemStoreResourceContainer;
import org.fao.geonet.api.records.attachments.Store;
import org.fao.geonet.constants.Geonet;
Expand Down Expand Up @@ -113,6 +113,7 @@
import java.io.StringReader;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.*;
Expand Down Expand Up @@ -1248,9 +1249,9 @@ public static String buildDataUrl(String url, Integer size) {
if (m.find()) {
Store store = ApplicationContextHolder.get().getBean("filesystemStore", Store.class);
try (Store.ResourceHolder file = store.getResourceInternal(
m.group(1),
URLDecoder.decode(m.group(1), Constants.ENCODING),
MetadataResourceVisibility.PUBLIC,
m.group(2), true)) {
URLDecoder.decode(m.group(2), Constants.ENCODING), true)) {
image = ImageIO.read(file.getPath().toFile());
}
} else {
Expand Down Expand Up @@ -1607,7 +1608,7 @@ public static String escapeForJson(String value) {
public static String escapeForEcmaScript(String value) {
return StringEscapeUtils.escapeEcmaScript(value);
}

public static String getWebAnalyticsService() {
ApplicationContext applicationContext = ApplicationContextHolder.get();
WebAnalyticsConfiguration webAnalyticsConfiguration = applicationContext.getBean(WebAnalyticsConfiguration.class);
Expand Down
Loading