From 3fa36ce6acad3abb1a2809fdaf5fbc41a4a473b1 Mon Sep 17 00:00:00 2001 From: Daniela Bauer Date: Wed, 11 Sep 2024 11:07:01 +0200 Subject: [PATCH] sweep: #7778 fix: return correct error for non-existing directory --- .../DirectoryManager/DirectoryLevelTree.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/DIRAC/DataManagementSystem/DB/FileCatalogComponents/DirectoryManager/DirectoryLevelTree.py b/src/DIRAC/DataManagementSystem/DB/FileCatalogComponents/DirectoryManager/DirectoryLevelTree.py index 5ff8388f556..6bdddfa71dd 100644 --- a/src/DIRAC/DataManagementSystem/DB/FileCatalogComponents/DirectoryManager/DirectoryLevelTree.py +++ b/src/DIRAC/DataManagementSystem/DB/FileCatalogComponents/DirectoryManager/DirectoryLevelTree.py @@ -274,6 +274,9 @@ def getPathIDs(self, path): pelements = [] dPath = "" for el in elements[1:]: + # skip entry path elements, e.g. path has trailing slash + if not el: + continue dPath += "/" + el pelements.append(dPath) pelements.append("/") @@ -283,6 +286,8 @@ def getPathIDs(self, path): result = self.db._query(req) if not result["OK"]: return result + if len(result["Value"]) != len(pelements): + return S_ERROR(f"Directory {path} not found") if not result["Value"]: return S_ERROR(f"Directory {path} not found")