do not override previous

This commit is contained in:
Thephaseless 2024-10-18 13:59:40 +00:00
parent aa9cf29755
commit 7a39415c5e
2 changed files with 6 additions and 2 deletions

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

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}")