Commit 0d256513 authored by Laurent Bachelier's avatar Laurent Bachelier

Fix cleanup of files with unicode paths

parent b64e8366
......@@ -202,7 +202,11 @@ class UnknownFile(File):
self._confname = os.path.join('files', hsh)
File.__init__(self, storage, '')
self.path =['info'].get('path')
pth =['info'].get('path')
if pth is not None:
self.path = pth.encode('utf-8')
self.path = None
def _get_confname(self):
return self._confname
# -*- coding: utf-8 -*-
from unittest import TestCase
from ass2m.cli import CLI
from import Storage
......@@ -88,3 +90,12 @@ class CleanupTest(TestCase):
f ='/hello')
assert['info'].get('view') is None
assert f.view is None
def test_unicode(self):
with open(os.path.join(, 'files', 'eed3d4c0aac6375a40412d0c4e689d3da85c44d0'), 'w') as f:
f.write('[info]\npath = /héy')
assert['ass2m_test', 'cleanup', '--gc']) in (0, None)
output = self.endCapture()
assert output.strip() == ''
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment