Fix symbolic links

This commit is contained in:
Will Miao
2025-02-23 14:03:55 +08:00
parent 97d14dea39
commit 3871557868
4 changed files with 22 additions and 15 deletions

View File

@@ -217,12 +217,12 @@ class ApiRoutes:
main_file = patterns[0]
main_path = os.path.join(target_dir, main_file)
if not os.path.exists(main_path):
raise web.HTTPNotFound(text=f"Model file not found: {main_file}")
# Delete main file first
os.remove(main_path)
deleted.append(main_file)
if os.path.exists(main_path):
# Delete main file first
os.remove(main_path)
deleted.append(main_file)
else:
logger.warning(f"Model file not found: {main_file}")
# Delete optional files
for pattern in patterns[1:]: