From f9f074ef01045caffbb46c397f24ef2c6226e6e5 Mon Sep 17 00:00:00 2001 From: Mr Chen Date: Wed, 27 Nov 2024 01:27:32 +0800 Subject: [PATCH] update --- web/core/mw.py | 2 ++ web/utils/file.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/core/mw.py b/web/core/mw.py index 32f7f9fe0..253aca131 100644 --- a/web/core/mw.py +++ b/web/core/mw.py @@ -546,6 +546,8 @@ def getFileStatsDesc( filename: str | None = None, path: str | None = None, ): + if path is None or filename is None: + return ';;;;;' try: filename = filename.replace('//', '/') stat = os.stat(filename) diff --git a/web/utils/file.py b/web/utils/file.py index a9adf31ea..948a8379c 100644 --- a/web/utils/file.py +++ b/web/utils/file.py @@ -295,7 +295,7 @@ def getAllDirList(path, page=1, size=10, order = '', search=None): for dst_file in plist: if not os.path.exists(dst_file): continue - stat = getFileStatsDesc(dst_file, path) + stat = getFileStatsDesc(filename=dst_file, path=path) if os.path.isdir(dst_file): dirnames.append(stat) else: @@ -343,7 +343,7 @@ def getDirList(path, page=1, size=10, order = '', search=None): if not os.path.exists(abs_file): continue - stats = getFileStatsDesc(abs_file, path) + stats = getFileStatsDesc(filename=abs_file, path=path) if os.path.isdir(abs_file): dirnames.append(stats) else: