mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2024-11-22 08:07:56 +01:00
Change some log messages when deleting files
This commit is contained in:
parent
aac93a1fd6
commit
7bdd2118a2
@ -25,13 +25,13 @@ def save_file(fname, contents):
|
|||||||
rel_path_str = os.path.relpath(abs_path_str, root_folder)
|
rel_path_str = os.path.relpath(abs_path_str, root_folder)
|
||||||
rel_path = Path(rel_path_str)
|
rel_path = Path(rel_path_str)
|
||||||
if rel_path.parts[0] == '..':
|
if rel_path.parts[0] == '..':
|
||||||
logger.error(f'Invalid file path: {fname}')
|
logger.error(f'Invalid file path: \"{fname}\"')
|
||||||
return
|
return
|
||||||
|
|
||||||
with open(abs_path_str, 'w', encoding='utf-8') as f:
|
with open(abs_path_str, 'w', encoding='utf-8') as f:
|
||||||
f.write(contents)
|
f.write(contents)
|
||||||
|
|
||||||
logger.info(f'Saved {abs_path_str}.')
|
logger.info(f'Saved \"{abs_path_str}\".')
|
||||||
|
|
||||||
|
|
||||||
def delete_file(fname):
|
def delete_file(fname):
|
||||||
@ -44,12 +44,12 @@ def delete_file(fname):
|
|||||||
rel_path_str = os.path.relpath(abs_path_str, root_folder)
|
rel_path_str = os.path.relpath(abs_path_str, root_folder)
|
||||||
rel_path = Path(rel_path_str)
|
rel_path = Path(rel_path_str)
|
||||||
if rel_path.parts[0] == '..':
|
if rel_path.parts[0] == '..':
|
||||||
logger.error(f'Invalid file path: {fname}')
|
logger.error(f'Invalid file path: \"{fname}\"')
|
||||||
return
|
return
|
||||||
|
|
||||||
if rel_path.exists():
|
if rel_path.exists():
|
||||||
rel_path.unlink()
|
rel_path.unlink()
|
||||||
logger.info(f'Deleted {fname}.')
|
logger.info(f'Deleted \"{fname}\".')
|
||||||
|
|
||||||
|
|
||||||
def current_time():
|
def current_time():
|
||||||
|
Loading…
Reference in New Issue
Block a user