From b51dab899f3cc83a25445039c0d52334cff64f89 Mon Sep 17 00:00:00 2001 From: Cameron Hyde Date: Thu, 16 Jan 2025 11:12:22 +1000 Subject: [PATCH] Fix force_download view --- app/labs/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/labs/views.py b/app/labs/views.py index 82164df..23d05dc 100644 --- a/app/labs/views.py +++ b/app/labs/views.py @@ -115,13 +115,13 @@ def force_download(self, request, relpath: Path, fname=None): logger.debug('Serving file %s' % relpath) response = serve( request, - os.path.basename(relpath), - os.path.dirname(settings.TEMP_DIR / relpath) + relpath, + settings.INTERNAL_ROOT, ) response['Content-Disposition'] = "attachment; filename=%s" % fname return response - url = settings.INTERNAL_URL + str(relpath) + url = settings.INTERNAL_URL + str(relpath).strip('/') logger.debug('Serving file via Nginx X-Accel-Redirect: %s' % relpath) response = HttpResponse() response['Content-Type'] = ''