Skip to content

Commit

Permalink
[fix] Use "path" URL kwarg in "serve_private_file" URL pattern #197
Browse files Browse the repository at this point in the history
Fixes #197
  • Loading branch information
pandafy committed Jun 9, 2022
1 parent e166999 commit 7265537
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion openwisp_firmware_upgrader/private_storage/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

urlpatterns = [
path(
urljoin(IMAGE_URL_PATH, '<path:imagefile>'),
# Use "path" URL kwarg to make it consistent with
# django-private-storage. Otherwise, the S3 reverse
# proxy feature of django-private-storage does
# not work.
urljoin(IMAGE_URL_PATH, '<path:path>'),
views.firmware_image_download,
name='serve_private_file',
),
Expand Down
2 changes: 1 addition & 1 deletion openwisp_firmware_upgrader/private_storage/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class FirmwareImageDownloadView(PrivateStorageDetailView):
model_file_field = 'file'

slug_field = 'file'
slug_url_kwarg = 'imagefile'
slug_url_kwarg = 'path'

def can_access_file(self, private_file):
user = private_file.request.user
Expand Down

0 comments on commit 7265537

Please sign in to comment.