From d2a4e506699c8dbb6bddfe88c26f33c5167f04ec Mon Sep 17 00:00:00 2001 From: neobooru <50623835+neobooru@users.noreply.github.com> Date: Sun, 8 Sep 2019 01:25:20 +0200 Subject: [PATCH] server/info: report correct size when filesystem is missing files Merges PR #279 --- server/szurubooru/api/info_api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/szurubooru/api/info_api.py b/server/szurubooru/api/info_api.py index 19b2be7c..b0721475 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