Make sure to operate on unicode when sanitzing sd filenames

Should fix #834
This commit is contained in:
Gina Häußge committed 2015-04-13 12:24:42 +02:00
1 parent a34cbc58dc
commit 594636e0e3
2 files changed
+6 -1

No files matched your search

+5
View File
@@ -306,6 +306,11 @@ def find_collision_free_name(filename, extension, existing_filenames, max_power=
# TODO unit test!
if not isinstance(filename, unicode):
filename = unicode(filename)
if not isinstance(extension, unicode):
extension = unicode(extension)
def make_valid(text):
return re.sub(r"\s+", "_", text.translate({ord(i):None for i in ".\"/\\[]:;=,"})).lower()
+1 -1
View File
@@ -313,7 +313,7 @@ class VirtualPrinter():
def _selectSdFile(self, filename):
if filename.startswith("/"):
filename = filename[1:]
file = os.path.join(self._virtualSd, filename).lower()
file = os.path.join(self._virtualSd, filename.lower())
if not os.path.exists(file) or not os.path.isfile(file):
self.outgoing.put("open failed, File: %s." % filename)
else: