From facf764660b2d45e125a2ac0196f4c7ee47fcd52 Mon Sep 17 00:00:00 2001 From: Cristiano Urban Date: Thu, 28 Oct 2021 13:58:43 +0200 Subject: [PATCH] Ignore symlinks in 'buildFileList()' method. Signed-off-by: Cristiano Urban --- transfer_service/retrieve_executor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/transfer_service/retrieve_executor.py b/transfer_service/retrieve_executor.py index b00b1cf..e322ce1 100644 --- a/transfer_service/retrieve_executor.py +++ b/transfer_service/retrieve_executor.py @@ -129,13 +129,13 @@ class RetrieveExecutor(TaskExecutor): srcPath = nodeInfo["fullPath"] username = nodeInfo["username"] md5calc = Checksum() - if os.path.isdir(srcPath): + if os.path.isdir(srcPath) and not os.path.islink(srcPath): for root, dirs, files in os.walk(srcPath, topdown = False): dirSize = os.stat(root).st_size self.totalSize += dirSize for f in files: fullPath = os.path.join(root, f) - if md5calc.fileIsValid(fullPath): + if md5calc.fileIsValid(fullPath) and not os.path.islink(fullPath): fileSize = os.stat(fullPath).st_size fileInfo = { "baseSrcPath": baseSrcPath, @@ -147,7 +147,7 @@ class RetrieveExecutor(TaskExecutor): self.totalSize += fileSize self.fileList.append(fileInfo.copy()) else: - if md5calc.fileIsValid(srcPath): + if md5calc.fileIsValid(srcPath) and not os.path.islink(srcPath): fileSize = nodeInfo["contentLength"] fileInfo = { "baseSrcPath": baseSrcPath, -- GitLab