diff --git a/app.py b/app.py index 11b939b..eff6cbc 100644 --- a/app.py +++ b/app.py @@ -76,9 +76,7 @@ def upload_file(): save_path = os.path.join("uploads", file.filename) if os.path.exists(save_path): - response = make_response(make_response("file already exists", 400)) - response.headers["Location"] = "/" - response.status_code = 400 + return make_response("file already exists", 400) try: file.save(save_path) @@ -91,9 +89,8 @@ def upload_file(): thread.start() print(f"thread started for {file.filename=}") - response = make_response(make_response("file uploaded succesfully", 301)) + response = make_response("file uploaded succesfully", 301) response.headers["Location"] = "/" - response.status_code = 301 return response