Skip to content

Commit 01cdbdb

Browse files
author
Tim Davies
committed
Fixes download server error. Closes #100
1 parent 5b2dc01 commit 01cdbdb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

prefix_finder/frontend/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,9 +493,9 @@ def list_details(request, prefix):
493493
raise Http404('Organisation list {} does not exist'.format(prefix))
494494
return render(request, 'list.html', context={'org_list': org_list, 'branch':use_branch})
495495

496-
def _get_filename():
497-
if git_commit_ref:
498-
return git_commit_ref[:10]
496+
def _get_filename(use_branch='master'):
497+
if git_commit_ref[use_branch]:
498+
return git_commit_ref[use_branch][:10]
499499
else:
500500
return datetime.datetime.now().strftime("%Y%m%d%H%M%S")
501501

@@ -540,7 +540,7 @@ def csv_download(request):
540540

541541
response = HttpResponse(output.getvalue(), content_type='text/csv')
542542

543-
response['Content-Disposition'] = 'attachment; filename="org-id-{0}.csv"'.format(_get_filename())
543+
response['Content-Disposition'] = 'attachment; filename="org-id-{0}.csv"'.format(_get_filename(use_branch))
544544
return response
545545

546546

0 commit comments

Comments
 (0)