Skip to content

Commit

Permalink
dcache-xroot: restore proper handling of single-slash paths
Browse files Browse the repository at this point in the history
Motivation:

https://rb.dcache.org/r/13923/
master@c491f2d312abcbadefcf1df2af85c5620e1e1867

introduced a regression which fails URLs like:

`xroot://example.org:1094/foo`

(single slash separating host from path).

Modification:

Catch the exception from `FsPath.create` and restore the
missing slash in that case.

Result:

Proper behavior restored.

Target: master
Patch: https://rb.dcache.org/r/13962/
Requires-notes:  no (unreleased change)
Acked-by: Tigran
  • Loading branch information
alrossi committed Apr 19, 2023
1 parent caf34ef commit 8ceacc8
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -1379,10 +1379,17 @@ private FsPath createFullPath(String path, Map<String, String> opaque)
throws PermissionDeniedCacheException {
String fromOpaque = opaque.get(EFFECTIVE_ROOT_NAME);
FsPath root = fromOpaque != null ? FsPath.create(fromOpaque) : effectiveRoot();

if (path.charAt(0) != '/') {
path = "/" + path;
}

FsPath fullPath = FsPath.create(path);

if (fullPath.hasPrefix(root)) {
path = fullPath.stripPrefix(root);
}

return root.chroot(path);
}

Expand Down

0 comments on commit 8ceacc8

Please sign in to comment.