prevented overwriteing of files and modified the filename of things that require a date
This commit is contained in:
Binary file not shown.
18
app/main.py
18
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]:
|
||||
|
||||
Reference in New Issue
Block a user