Skip to content

Commit

Permalink
Merge pull request #1 from JeffHeard/master
Browse files Browse the repository at this point in the history
removed login requirement; added content type to file download to preser...
  • Loading branch information
mjstealey committed Oct 31, 2014
2 parents a45cf45 + b4a96c1 commit aad4531
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from django.conf import settings
from django.http import HttpResponse

@login_required
def download(request, *args, **kwargs):
if 'environment' in kwargs:
environment = int(kwargs['environment'])
Expand All @@ -23,12 +22,11 @@ def download(request, *args, **kwargs):
path = request.GET['path']

proc = session.run_safe('iget', None, path, *options)
response = HttpResponse(proc.stdout.read())
response = HttpResponse(proc.stdout.read(), content_type='application-x/octet-stream')
response['Content-Disposition'] = 'attachment; filename="{name}"'.format(name=path.split('/')[-1])
return response


@login_required
def list(request, *args, **kwargs):
if 'environment' in kwargs:
environment = int(kwargs['environment'])
Expand All @@ -45,4 +43,4 @@ def list(request, *args, **kwargs):

proc = session.run_safe('ils', None, *options)
response = HttpResponse(proc.stdout)
return response
return response

0 comments on commit aad4531

Please sign in to comment.