Refactor path -> filename

This commit is contained in:
PCoder 2021-07-28 09:49:30 +05:30
parent 13b2995c34
commit b266da63b2

View file

@ -77,13 +77,13 @@ class ReindexPageView(TemplateView):
return HttpResponsePermanentRedirect(reverse('admin:index')) return HttpResponsePermanentRedirect(reverse('admin:index'))
def send_from_file(request, path): def send_from_file(request, filename):
request_for = '' request_for = ''
if request.path.startswith('/geodata'): if request.path.startswith('/geodata'):
request_for = 'geodata' request_for = 'geodata'
elif request.path.startswith('/data'): elif request.path.startswith('/data'):
request_for = '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') file_to_send = open(file_path, 'rb')
response = FileResponse(file_to_send) response = FileResponse(file_to_send)
return response return response