diff --git a/ddcz/urls.py b/ddcz/urls.py index d234df5..7b75315 100644 --- a/ddcz/urls.py +++ b/ddcz/urls.py @@ -76,6 +76,11 @@ views.creation_detail_image, name="creation-detail-image", ), + re_path( + r"obr_pris/(?P[\w\/]+\.[\w]+)", + views.creation_detail_image_legacy, + name="creation-legacy-detail-image", + ), # Standard list and detail are under creation pages above, # Those are for executing redirect to download/quest location path("download//", views.download_file, name="download-file"), diff --git a/ddcz/views/creations.py b/ddcz/views/creations.py index fbdffd9..f7e3358 100644 --- a/ddcz/views/creations.py +++ b/ddcz/views/creations.py @@ -237,6 +237,18 @@ def creation_detail_image( ) +# This allows unfiltered traversion of the static path; shouldn't be a problem in the s3 bucket, +# but should be deleted if we're moving somewhere else +@require_http_methods(["HEAD", "GET"]) +def creation_detail_image_legacy( + request, + image_path, +): + return HttpResponsePermanentRedirect( + f"{settings.CREATION_PICTURES_MEDIA_ROOT_URL}{image_path}" + ) + + @require_http_methods(["HEAD", "GET"]) def creative_page_concept(request, creative_page_slug): creative_page = get_object_or_404(CreativePage, slug=creative_page_slug)