From a1e2f05cf1db74281e6a5a8a7f49226be84519b2 Mon Sep 17 00:00:00 2001 From: Anders Bruun Severinsen <202204885@post.au.dk> Date: Wed, 6 Nov 2024 09:17:50 +0100 Subject: [PATCH] Fix gallery error --- gallery/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gallery/views.py b/gallery/views.py index be2231e..787d840 100644 --- a/gallery/views.py +++ b/gallery/views.py @@ -165,6 +165,8 @@ def image(request, year, album_slug, image_slug, **kwargs): @permission_required("gallery.add_image", raise_exception=True) def upload(request): file = upload_receive(request) + if file is None: + return UploadResponse(request, {"error": "No file"}) album = Album.objects.get(id=int(request.POST["object_id"])) ext = os.path.splitext(file.name)[1].lower()