diff --git a/classquiz/routers/storage.py b/classquiz/routers/storage.py index e363661..5a0b58f 100644 --- a/classquiz/routers/storage.py +++ b/classquiz/routers/storage.py @@ -8,6 +8,7 @@ from fastapi import APIRouter, HTTPException from fastapi.responses import StreamingResponse from classquiz.config import settings, storage +from classquiz.storage.errors import DownloadingFailedError settings = settings() @@ -20,8 +21,10 @@ file_regex = r"^[a-z0-9]{8}-[a-z0-9-]{27}--[a-z0-9-]{36}$" async def download_file(file_name: str): if not re.match(file_regex, file_name): raise HTTPException(status_code=400, detail="Invalid file name") - - download = await storage.download(file_name) + try: + download = await storage.download(file_name) + except DownloadingFailedError: + raise HTTPException(status_code=404, detail="File not found") if download is None: raise HTTPException(status_code=404, detail="File not found") diff --git a/frontend/pnpm-lock.yaml b/frontend/pnpm-lock.yaml index e91330a..36f370e 100644 --- a/frontend/pnpm-lock.yaml +++ b/frontend/pnpm-lock.yaml @@ -89,7 +89,7 @@ devDependencies: '@sentry/tracing': 7.20.0 '@sveltejs/adapter-auto': 1.0.0-next.89 '@sveltejs/adapter-node': 1.0.0-next.100 - '@sveltejs/kit': 1.0.0-next.555_svelte@3.53.1+vite@3.2.4 + '@sveltejs/kit': 1.0.0-next.560_svelte@3.53.1+vite@3.2.4 '@tailwindcss/typography': 0.5.8_tailwindcss@3.2.4 '@types/canvas-confetti': 1.6.0 '@types/cookie': 0.5.1 @@ -954,10 +954,10 @@ packages: rollup: 2.79.1 dev: true - /@sveltejs/kit/1.0.0-next.555_svelte@3.53.1+vite@3.2.4: + /@sveltejs/kit/1.0.0-next.560_svelte@3.53.1+vite@3.2.4: resolution: { - integrity: sha512-hrxmS77sLe3l0G1VTRm2fhM+VgVBiW7fuxluB10dnb3p3e5QnjuMDDPyxYwobzGnNYcXRm/Wu3z7CmGHhHGmag== + integrity: sha512-ldZJyd+jfQWVkOkRHq25cXMffhL5MgB1Uzhhw1ngF8ezB38P/g4T+5ohP8wuk2lxPJIjbY3S6BeXN5mod9XOhA== } engines: { node: '>=16.14' } hasBin: true diff --git a/frontend/src/lib/inline-editor_new_trash.svelte b/frontend/src/lib/inline-editor_new_trash.svelte new file mode 100644 index 0000000..a641277 --- /dev/null +++ b/frontend/src/lib/inline-editor_new_trash.svelte @@ -0,0 +1,100 @@ + + + +