Refactor path -> filename

This commit is contained in:
PCoder 2021-07-28 09:49:30 +05:30
parent 13b2995c34
commit b266da63b2
1 changed files with 2 additions and 2 deletions

View File

@ -77,13 +77,13 @@ class ReindexPageView(TemplateView):
return HttpResponsePermanentRedirect(reverse('admin:index'))
def send_from_file(request, path):
def send_from_file(request, filename):
request_for = ''
if request.path.startswith('/geodata'):
request_for = 'geodata'
elif request.path.startswith('/data'):
request_for = 'data'
file_path = ospath.join(DATA_PATH, request_for, path)
file_path = ospath.join(DATA_PATH, request_for, filename)
file_to_send = open(file_path, 'rb')
response = FileResponse(file_to_send)
return response