summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorneobooru <50623835+neobooru@users.noreply.github.com>2019-09-08 01:25:20 +0200
committerShyam Sunder <sgsunder1@gmail.com>2019-09-29 23:07:53 -0400
commitd2a4e506699c8dbb6bddfe88c26f33c5167f04ec (patch)
tree620594c568804d66fcc34e09fc1013e9600ad8e0 /server
parent4fe9c5f4ca2a4f0a0e170363a7ccfe79ff3bb3f3 (diff)
server/info: report correct size when filesystem is missing files
Merges PR #279
Diffstat (limited to 'server')
-rw-r--r--server/szurubooru/api/info_api.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/server/szurubooru/api/info_api.py b/server/szurubooru/api/info_api.py
index 19b2be7..b072147 100644
--- a/server/szurubooru/api/info_api.py
+++ b/server/szurubooru/api/info_api.py
@@ -20,7 +20,10 @@ def _get_disk_usage() -> int:
for dir_path, _, file_names in os.walk(config.config['data_dir']):
for file_name in file_names:
file_path = os.path.join(dir_path, file_name)
- total_size += os.path.getsize(file_path)
+ try:
+ total_size += os.path.getsize(file_path)
+ except FileNotFoundError:
+ pass
_cache_time = now
_cache_result = total_size
return total_size