fix 301/400 responses
This commit is contained in:
parent
649624fb25
commit
ab83fcef30
7
app.py
7
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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user