Fix not returning default on nonexistant file

This commit is contained in:
0xDEADCADE 2022-04-08 20:16:21 +00:00 committed by GitHub
parent fa0451a525
commit d0ce13cebc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,6 +35,8 @@ def load_data(path, default={}):
return json.load(f) return json.load(f)
except json.decoder.JSONDecodeError: except json.decoder.JSONDecodeError:
return default return default
else:
return default
# Cache for files sent to the homeserver, prevents reuploading existing files # Cache for files sent to the homeserver, prevents reuploading existing files
file_cache = load_data(settings["file_cache_path"]) file_cache = load_data(settings["file_cache_path"])