Skip to content

Commit

Permalink
Better redirect for legacy obr_pris
Browse files Browse the repository at this point in the history
  • Loading branch information
Almad committed Aug 29, 2024
1 parent 67de68a commit e7f49b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ddcz/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@
views.creation_detail_image,
name="creation-detail-image",
),
re_path(
r"obr_pris/(?P<image_path>[\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/<int:download_id>/", views.download_file, name="download-file"),
Expand Down
12 changes: 12 additions & 0 deletions ddcz/views/creations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e7f49b0

Please sign in to comment.