Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
VOSpace INAF
vospace-rest
Commits
c7699de8
Commit
c7699de8
authored
Nov 12, 2021
by
Sonia Zorba
Browse files
Other fixes for special characters
parent
7e0a7327
Pipeline
#7982
passed with stages
in 2 minutes and 33 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/main/java/it/inaf/oats/vospace/FileServiceClient.java
View file @
c7699de8
...
...
@@ -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
();
...
...
src/main/java/it/inaf/oats/vospace/UriService.java
View file @
c7699de8
...
...
@@ -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
);
}
...
...
src/test/java/it/inaf/oats/vospace/FileServiceClientTest.java
View file @
c7699de8
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment