titles are not filename safe

This commit is contained in:
j 2012-01-17 16:42:39 +05:30
commit 0700bf7b95
3 changed files with 13 additions and 4 deletions

View file

@ -725,7 +725,7 @@ def torrent(request, id, filename=None):
if not filename or filename.endswith('.torrent'):
response = HttpResponse(item.get_torrent(request),
content_type='application/x-bittorrent')
filename = "%s.torrent" % item.get('title')
filename = utils.safe_filename("%s.torrent" % item.get('title'))
response['Content-Disposition'] = 'attachment; filename="%s"' % filename.encode('utf-8')
return response
while filename.startswith('/'):