Skip to content

Commit

Permalink
Merge pull request #433 from bargool/master
Browse files Browse the repository at this point in the history
Escape unicode filename while download attachment
  • Loading branch information
benjaoming committed Jun 15, 2015
2 parents ef17887 + dbcf87d commit 9db0d8a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions wiki/core/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from django.http import HttpResponse
from django.utils.http import http_date
from django.utils import dateformat
from django.utils.encoding import filepath_to_uri

from wiki.conf import settings

Expand Down Expand Up @@ -44,8 +45,8 @@ def send_file(request, filepath, last_modified=None, filename=None):
if encoding:
response["Content-Encoding"] = encoding

# TODO: Escape filename
if filename:
response["Content-Disposition"] = "attachment; filename=%s" % filename
filename_escaped = filepath_to_uri(filename)
response["Content-Disposition"] = "attachment; filename=%s" % filename_escaped

return response

0 comments on commit 9db0d8a

Please sign in to comment.