]> git.0d.be Git - django-panik-nonstop.git/commitdiff
encode filenames in utf-8
authorFrédéric Péters <fpeters@0d.be>
Fri, 9 Feb 2018 17:03:58 +0000 (18:03 +0100)
committerFrédéric Péters <fpeters@0d.be>
Fri, 9 Feb 2018 17:03:58 +0000 (18:03 +0100)
nonstop/views.py

index f89e17cd38adf9f700ea8c5688089095b589d950..f70333dad30297db2000e43d39c235771fe88c0b 100644 (file)
@@ -199,11 +199,11 @@ class UploadTracksView(FormView):
             track_title = metadata.get('title')[0]
 
             monthdir = datetime.datetime.today().strftime('%Y-%m')
-            filepath = '%s/%s - %s - %s%s' % (monthdir,
+            filepath = u'%s/%s - %s - %s%s' % (monthdir,
                 datetime.datetime.today().strftime('%y%m%d'),
                 artist_name[:50].replace('/', ' ').strip(),
                 track_title[:80].replace('/', ' ').strip(),
-                os.path.splitext(f.name)[-1])
+                os.path.splitext(f.name)[-1]).encode('utf-8')
 
             default_storage.save(os.path.join('nonstop', 'tracks', filepath), content=f)