Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -943,16 +943,16 @@ async def handle_upload(file: UploadFile = File(...)):
|
|
943 |
|
944 |
cookies = await get_cookies()
|
945 |
if 'csrftoken' not in cookies or 'sessionid' not in cookies:
|
946 |
-
return JSONResponse(content={"error": "Failed
|
947 |
|
948 |
upload_result = await initiate_upload(cookies, file.filename, file.content_type)
|
949 |
if not upload_result or 'upload_url' not in upload_result:
|
950 |
-
return JSONResponse(content={"error": "Failed to
|
951 |
|
952 |
file_content = await file.read()
|
953 |
upload_success = await retry_upload(upload_result['upload_url'], file_content, file.content_type)
|
954 |
if not upload_success:
|
955 |
-
return JSONResponse(content={"error": "
|
956 |
|
957 |
original_url = upload_result['serving_url']
|
958 |
mirrored_url = f"/rbxg/{original_url.split('/pbxt/')[1]}"
|
@@ -1072,6 +1072,6 @@ async def retry_upload(upload_url: str, file_content: bytes, content_type: str,
|
|
1072 |
print(f"Error during upload: {e}")
|
1073 |
|
1074 |
await asyncio.sleep(delay)
|
1075 |
-
delay = min(delay * 2, 60)
|
1076 |
|
1077 |
return False
|
|
|
943 |
|
944 |
cookies = await get_cookies()
|
945 |
if 'csrftoken' not in cookies or 'sessionid' not in cookies:
|
946 |
+
return JSONResponse(content={"error": "Failed"}, status_code=500)
|
947 |
|
948 |
upload_result = await initiate_upload(cookies, file.filename, file.content_type)
|
949 |
if not upload_result or 'upload_url' not in upload_result:
|
950 |
+
return JSONResponse(content={"error": "Failed to upload"}, status_code=500)
|
951 |
|
952 |
file_content = await file.read()
|
953 |
upload_success = await retry_upload(upload_result['upload_url'], file_content, file.content_type)
|
954 |
if not upload_success:
|
955 |
+
return JSONResponse(content={"error": "FAILED GOD MAN AFTER alot of attempts"}, status_code=500)
|
956 |
|
957 |
original_url = upload_result['serving_url']
|
958 |
mirrored_url = f"/rbxg/{original_url.split('/pbxt/')[1]}"
|
|
|
1072 |
print(f"Error during upload: {e}")
|
1073 |
|
1074 |
await asyncio.sleep(delay)
|
1075 |
+
delay = min(delay * 2, 60)
|
1076 |
|
1077 |
return False
|