From 8895e99063ecdbdb2afea72b278d532158678487 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 24 Jan 2012 15:29:04 +0530 Subject: [PATCH] return utf-8 filenames --- pandora/item/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandora/item/views.py b/pandora/item/views.py index ce61b2939..8ea16b4c8 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -768,7 +768,7 @@ def video(request, id, resolution, format, index=None): content_type = mimetypes.guess_type(path)[0] if len(t) == 2 and t[1] > t[0] and stream.info['duration']>=t[1]: response = HttpResponse(extract.chop(path, t[0], t[1]), content_type=content_type) - filename = "Clip of %s - %s-%s - %s %s%s" % ( + filename = u"Clip of %s - %s-%s - %s %s%s" % ( item.get('title'), ox.formatDuration(t[0] * 1000).replace(':', '.')[:-4], ox.formatDuration(t[1] * 1000).replace(':', '.')[:-4], @@ -776,6 +776,7 @@ def video(request, id, resolution, format, index=None): item.itemId, ext ) + filename = filename.encode('utf8') response['Content-Disposition'] = 'attachment; filename="%s"' % filename return response else: @@ -786,6 +787,7 @@ def video(request, id, resolution, format, index=None): ext ) response = HttpFileResponse(path, content_type=content_type) + filename = filename.encode('utf8') response['Content-Disposition'] = 'attachment; filename="%s"' % filename return response if not settings.XSENDFILE and not settings.XACCELREDIRECT: