Remove ? from filename

When taking screenshot of Youtube video in mpv the filename will be watch?v=QtDl1neofaM_0001_00_02_30.901.webp
This commit is contained in:
2022-07-06 20:30:42 +02:00
parent fcc6eb0bbc
commit ce3400828e

View File

@ -53,6 +53,10 @@ async def upload_file(file: UploadFile = File(...)) -> Dict[str, str]:
# Replace spaces with dots in filename.
filename = file.filename.replace(" ", ".")
# Remove ? from filename.
# TODO: Make a list of every illegal character and remove them.
filename = filename.replace("?", "")
with open(f"{settings.upload_folder}/{filename}", "wb+") as f:
f.write(file.file.read())