Model Path Hardening

This commit is contained in:
Henk 2022-06-15 13:29:10 +02:00
parent 24d34647e0
commit fb2b6f1026
1 changed files with 5 additions and 2 deletions

View File

@ -3112,7 +3112,7 @@ def get_message(msg):
# If we're on a custom line that we have selected a model for, the path variable will be in msg # If we're on a custom line that we have selected a model for, the path variable will be in msg
# so if that's missing we need to run the menu to show the model folders in the models folder # so if that's missing we need to run the menu to show the model folders in the models folder
if msg['data'] in ('NeoCustom', 'GPT2Custom') and 'path' not in msg and 'path_modelname' not in msg: if msg['data'] in ('NeoCustom', 'GPT2Custom') and 'path' not in msg and 'path_modelname' not in msg:
if 'folder' not in msg: if 'folder' not in msg or vars.host:
folder = "./models" folder = "./models"
else: else:
folder = msg['folder'] folder = msg['folder']
@ -3135,7 +3135,10 @@ def get_message(msg):
vars.custmodpth = msg['path'] vars.custmodpth = msg['path']
get_model_info(msg['data'], directory=msg['path']) get_model_info(msg['data'], directory=msg['path'])
else: else:
sendModelSelection(menu=msg['data'], folder=msg['path']) if vars.host:
sendModelSelection(menu=msg['data'], folder="./models")
else:
sendModelSelection(menu=msg['data'], folder=msg['path'])
else: else:
vars.model = msg['data'] vars.model = msg['data']
if 'path' in msg: if 'path' in msg: