fixed: robust loading comfy.settings.json (#6383)

https://github.com/comfyanonymous/ComfyUI/issues/6371
This commit is contained in:
Dr.Lt.Data 2025-01-08 06:03:56 +09:00 committed by GitHub
parent 4209edf48d
commit c515bdf371
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,7 @@
import os
import json
from aiohttp import web
import logging
class AppSettings():
@ -11,8 +12,12 @@ class AppSettings():
file = self.user_manager.get_request_user_filepath(
request, "comfy.settings.json")
if os.path.isfile(file):
try:
with open(file) as f:
return json.load(f)
except:
logging.error(f"The user settings file is corrupted: {file}")
return {}
else:
return {}