do not override previous

This commit is contained in:
ThePhaseless
2024-10-18 15:53:36 +00:00
parent b7f9c1467c
commit d452d43ee8
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: error-screenshots
path: ./errors
path: ./errors/*
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
+5 -1
View File
@@ -3,6 +3,7 @@ from __future__ import annotations
import asyncio
import logging
import time
from pathlib import Path
import uvicorn
import uvicorn.config
@@ -39,7 +40,10 @@ async def read_item(request: LinkRequest):
try:
challenged = await asyncio.wait_for(bypass_cloudflare(page), timeout=timeout)
except asyncio.TimeoutError as e:
await page.save_screenshot("errors/error.png")
i = 0
while Path(f"errors/error{i}.png").is_file():
i += 1
await page.save_screenshot(f"errors/error{i}.png")
raise HTTPException(detail="Timeout", status_code=408) from e
logger.info(f"Got webpage: {request.url}")