fix: improve example image upload reliability and error handling, #804

- Sequential per-file upload to avoid client_max_size limits
- Add backend exception handler with proper 500 responses
- Increase standalone server upload limit to 256MB
- Add partial success localization support
This commit is contained in:
Will Miao
2026-02-08 09:16:48 +08:00
parent 199c9f742c
commit b4ad03c9bf
13 changed files with 63 additions and 27 deletions

View File

@@ -1,11 +1,14 @@
"""Handler set for example image routes."""
from __future__ import annotations
import logging
from dataclasses import dataclass
from typing import Callable, Mapping
from aiohttp import web
logger = logging.getLogger(__name__)
from ...services.use_cases.example_images import (
DownloadExampleImagesConfigurationError,
DownloadExampleImagesInProgressError,
@@ -122,6 +125,9 @@ class ExampleImagesManagementHandler:
return web.json_response({'success': False, 'error': str(exc)}, status=400)
except ExampleImagesImportError as exc:
return web.json_response({'success': False, 'error': str(exc)}, status=500)
except Exception as exc:
logger.exception("Unexpected error importing example images")
return web.json_response({'success': False, 'error': str(exc)}, status=500)
async def delete_example_image(self, request: web.Request) -> web.StreamResponse:
return await self._processor.delete_custom_image(request)