Skip to content

Commit

Permalink
Metadata file store / Encode file name for URL. (geonetwork#2587)
Browse files Browse the repository at this point in the history
  • Loading branch information
fxprunayre committed Apr 12, 2018
1 parent a56d290 commit bdb6192
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

package org.fao.geonet.api.records.attachments;

import com.google.common.net.UrlEscapers;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.fao.geonet.ApplicationContextHolder;
Expand Down Expand Up @@ -124,7 +125,9 @@ public List<MetadataResource> getResources(ServiceContext context, String metada
Files.newDirectoryStream(resourceTypeDir, filter)) {
for (Path path : directoryStream) {
MetadataResource resource = new FilesystemStoreResource(
metadataUuid + "/attachments/" + path.getFileName(),
UrlEscapers.urlFragmentEscaper().escape(metadataUuid) +
"/attachments/" +
UrlEscapers.urlFragmentEscaper().escape(path.getFileName().toString()),
settingManager.getNodeURL() + "api/records/",
visibility,
Files.size(path));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<a href=""
title="{{'clickToAddResource' | translate}}"
data-ng-click="setResource(r)">
{{r.id.split('/').splice(2).join('/')}}
{{r.id.split('/').splice(2).join('/') | decodeURIComponent}}
</a>
</td>
<td>
Expand Down

0 comments on commit bdb6192

Please sign in to comment.