Commit fa0b4c43 authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Other fixes for special characters

parent 50052eeb
Pipeline #8723 canceled with stages
in 7 seconds
......@@ -54,7 +54,7 @@ public class FileServiceClient {
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();
......
......@@ -181,8 +181,7 @@ public class UriService {
private String getEndpoint(JobSummary job, Transfer transfer) {
String relativePath = StringUtils.uriDecode(URIUtils
.returnVosPathFromNodeURI(transfer.getTarget(), authority), StandardCharsets.UTF_8);
String relativePath = NodeUtils.getVosPath(transfer.getTarget());
User user = (User) servletRequest.getUserPrincipal();
String creator = user.getName();
......@@ -204,7 +203,6 @@ public class UriService {
case pullFromVoSpace:
// Refresh relative path: it can differ in case of links followed
relativePath = NodeUtils.getVosPath(node);
relativePath = StringUtils.uriDecode(relativePath, StandardCharsets.UTF_8);
if (!NodeUtils.checkIfReadable(node, creator, groups)) {
throw PermissionDeniedException.forPath(relativePath);
}
......
......@@ -2,4 +2,5 @@ rap_uri=https://sso.ia2.inaf.it/rap-ia2
gms_uri=https://sso.ia2.inaf.it/gms/
groups_autoload=true
client_id=vospace_test
client_secret=***REMOVED***
\ No newline at end of file
client_secret=***REMOVED***
......@@ -101,23 +101,23 @@ public class FileServiceClientTest {
Transfer transfer = new Transfer();
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.setUri(Views.ZIP_VIEW_URI);
transfer.setView(view);
ContainerNode node = Mockito.mock(ContainerNode.class);
when(node.getNodes()).thenReturn(List.of());
when(node.getUri()).thenReturn("vos://example.com!vospace/mydir");
when(nodeDAO.listNode(eq("/mydir"))).thenReturn(Optional.of(node));
when(node.getUri()).thenReturn("vos://example.com!vospace/mydir(%20+%20)x");
when(nodeDAO.listNode(eq("/mydir( + )x"))).thenReturn(Optional.of(node));
when(linkService.followLinksForArchiveService(any()))
.thenReturn(List.of(new ArchiveEntryDescriptor("/mydir")));
.thenReturn(List.of(new ArchiveEntryDescriptor("/mydir( + )x")));
ArchiveRequest archiveRequest = testStartArchiveJob(transfer);
assertEquals(1, archiveRequest.getEntryDescriptors().size());
assertEquals("/mydir", archiveRequest.getEntryDescriptors().get(0).getTargetNodeVosPath());
assertEquals("/mydir( + )x", archiveRequest.getEntryDescriptors().get(0).getTargetNodeVosPath());
}
@Test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment