Skip to content

Commit

Permalink
Fixed broken image serving in development server
Browse files Browse the repository at this point in the history
  • Loading branch information
crohkohl committed Aug 7, 2015
1 parent f42f473 commit 0e134b1
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions digits/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,8 @@ def serve_file(path):
raise werkzeug.exceptions.NotFound('File not found')
if os.path.isdir(path):
raise werkzeug.exceptions.Forbidden('Folder cannot be served')

with open(path, 'r') as infile:
response = flask.make_response(infile.read())
response.headers["Content-Disposition"] = "attachment; filename=%s" % os.path.basename(path)
return response

return flask.send_file(path)

### Path Completion

Expand Down

0 comments on commit 0e134b1

Please sign in to comment.