Fix for UI1 remote mode file loading from browser

This commit is contained in:
ebolam
2023-04-16 20:43:03 -04:00
parent fcba26f631
commit a34ce85d21

View File

@@ -7454,13 +7454,13 @@ def loadRequest(loadpath, filename=None):
if not loadpath:
return
#Original UI only sends the story name and assumes it's always a .json file... here we check to see if it's a directory to load that way
if not os.path.exists(loadpath):
if not isinstance(loadpath, dict) and not os.path.exists(loadpath):
if os.path.exists(loadpath.replace(".json", "")):
loadpath = loadpath.replace(".json", "")
if os.path.isdir(loadpath):
if not isinstance(loadpath, dict) and os.path.isdir(loadpath):
if not valid_v3_story(loadpath):
raise RuntimeError(f"Tried to load {loadpath}, a non-save directory.")
koboldai_vars.update_story_path_structure(loadpath)