diff --git a/app/__pycache__/main.cpython-313.pyc b/app/__pycache__/main.cpython-313.pyc index 9bc14bc..25c1d46 100644 Binary files a/app/__pycache__/main.cpython-313.pyc and b/app/__pycache__/main.cpython-313.pyc differ diff --git a/app/main.py b/app/main.py index 17ded4b..bc4ef07 100644 --- a/app/main.py +++ b/app/main.py @@ -24,6 +24,7 @@ import datetime import logging import inspect +import pathlib from starlette.types import HTTPExceptionHandler @@ -607,9 +608,20 @@ def make_savepath( 400, "You have not specified a date for an upload that requires a date like an exam.", ) - filename += yyyy + "_" + mm + "_" + dd + "_" - filename += fname + "." + ftype - return savepath + filename + filename = yyyy + "_" + mm + "_" + dd + "_" + filename += fname + file = filename + "." + ftype + + destpath = pathlib.Path(savepath + file) + i = 0 + info(destpath) + info(destpath.is_file()) + while destpath.is_file(): + file = filename + f"_{i}." + ftype + i += 1 + destpath = pathlib.Path(savepath + file) + destpath.touch() + return savepath + file def get_lvpath(lva: str) -> Tuple[int, str]: