Skip to content
Snippets Groups Projects
Commit fa0b4c43 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Other fixes for special characters

parent 50052eeb
No related branches found
No related tags found
No related merge requests found
Pipeline #8723 canceled
...@@ -54,7 +54,7 @@ public class FileServiceClient { ...@@ -54,7 +54,7 @@ public class FileServiceClient {
public String startArchiveJob(Transfer transfer, String jobId) { public String startArchiveJob(Transfer transfer, String jobId) {
String target = transfer.getTarget().substring("vos://".length() + authority.length()); String target = NodeUtils.getVosPath(transfer.getTarget());
String viewUri = transfer.getView().getUri(); String viewUri = transfer.getView().getUri();
......
...@@ -181,8 +181,7 @@ public class UriService { ...@@ -181,8 +181,7 @@ public class UriService {
private String getEndpoint(JobSummary job, Transfer transfer) { private String getEndpoint(JobSummary job, Transfer transfer) {
String relativePath = StringUtils.uriDecode(URIUtils String relativePath = NodeUtils.getVosPath(transfer.getTarget());
.returnVosPathFromNodeURI(transfer.getTarget(), authority), StandardCharsets.UTF_8);
User user = (User) servletRequest.getUserPrincipal(); User user = (User) servletRequest.getUserPrincipal();
String creator = user.getName(); String creator = user.getName();
...@@ -204,7 +203,6 @@ public class UriService { ...@@ -204,7 +203,6 @@ public class UriService {
case pullFromVoSpace: case pullFromVoSpace:
// Refresh relative path: it can differ in case of links followed // Refresh relative path: it can differ in case of links followed
relativePath = NodeUtils.getVosPath(node); relativePath = NodeUtils.getVosPath(node);
relativePath = StringUtils.uriDecode(relativePath, StandardCharsets.UTF_8);
if (!NodeUtils.checkIfReadable(node, creator, groups)) { if (!NodeUtils.checkIfReadable(node, creator, groups)) {
throw PermissionDeniedException.forPath(relativePath); throw PermissionDeniedException.forPath(relativePath);
} }
......
...@@ -3,3 +3,4 @@ gms_uri=https://sso.ia2.inaf.it/gms/ ...@@ -3,3 +3,4 @@ gms_uri=https://sso.ia2.inaf.it/gms/
groups_autoload=true groups_autoload=true
client_id=vospace_test client_id=vospace_test
client_secret=***REMOVED*** client_secret=***REMOVED***
...@@ -101,23 +101,23 @@ public class FileServiceClientTest { ...@@ -101,23 +101,23 @@ public class FileServiceClientTest {
Transfer transfer = new Transfer(); Transfer transfer = new Transfer();
transfer.setDirection("pullFromVoSpace"); transfer.setDirection("pullFromVoSpace");
transfer.setTarget("vos://example.com!vospace/mydir"); transfer.setTarget("vos://example.com!vospace/mydir(%20+%20)x");
View view = new View(); View view = new View();
view.setUri(Views.ZIP_VIEW_URI); view.setUri(Views.ZIP_VIEW_URI);
transfer.setView(view); transfer.setView(view);
ContainerNode node = Mockito.mock(ContainerNode.class); ContainerNode node = Mockito.mock(ContainerNode.class);
when(node.getNodes()).thenReturn(List.of()); when(node.getNodes()).thenReturn(List.of());
when(node.getUri()).thenReturn("vos://example.com!vospace/mydir"); when(node.getUri()).thenReturn("vos://example.com!vospace/mydir(%20+%20)x");
when(nodeDAO.listNode(eq("/mydir"))).thenReturn(Optional.of(node)); when(nodeDAO.listNode(eq("/mydir( + )x"))).thenReturn(Optional.of(node));
when(linkService.followLinksForArchiveService(any())) when(linkService.followLinksForArchiveService(any()))
.thenReturn(List.of(new ArchiveEntryDescriptor("/mydir"))); .thenReturn(List.of(new ArchiveEntryDescriptor("/mydir( + )x")));
ArchiveRequest archiveRequest = testStartArchiveJob(transfer); ArchiveRequest archiveRequest = testStartArchiveJob(transfer);
assertEquals(1, archiveRequest.getEntryDescriptors().size()); assertEquals(1, archiveRequest.getEntryDescriptors().size());
assertEquals("/mydir", archiveRequest.getEntryDescriptors().get(0).getTargetNodeVosPath()); assertEquals("/mydir( + )x", archiveRequest.getEntryDescriptors().get(0).getTargetNodeVosPath());
} }
@Test @Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment