sharing/map: catch collection path with missing trailing /

This commit is contained in:
Peter Bieringer
2026-08-01 08:46:05 +02:00
parent c65b8fee09
commit 9f2d193fa5

View File

@@ -647,9 +647,19 @@ class BaseSharing:
if result:
result['PathMapped'] = path.replace(parent_path, result['PathMapped'])
logger.trace("sharing/map/resolver: PathMapped=%r Permissions=%r by parent_path=%r", result['PathMapped'], result['Permissions'], parent_path)
else:
logger.trace("sharing/map/resolver: not found")
return None
if not result and not path.endswith("/"):
# assume collection path with missing trailing /
path_with_trailing_slash = path + "/"
logger.trace("sharing/map/resolver: check path having '/' appended: %r", path_with_trailing_slash)
result = self.database_get_sharing(
ShareType="map",
PathOrToken=path_with_trailing_slash,
OnlyEnabled=False,
User=user)
if result:
path = path_with_trailing_slash
logger.trace("sharing/map/resolver: PathMapped=%r Permissions=%r by path_with_trailing_slash=%r", result['PathMapped'], result['Permissions'], path_with_trailing_slash)
if result:
if result['EnabledByOwner'] is not True:
@@ -667,6 +677,7 @@ class BaseSharing:
logger.info("sharing/%s: resolved path %r->%r, user %r->%r, Permissions=%r Conversion=%r", "map", result['PathOrToken'], result['PathMapped'], user, result['Owner'], result['Permissions'], result['Conversion'])
return result
logger.trace("sharing/map/resolver: not found")
return None
else:
logger.trace("sharing/map: not active")