Make sure to operate on unicode when sanitzing sd filenames
Should fix #834
This commit is contained in:
parent
a34cbc58dc
commit
594636e0e3
2 changed files with 6 additions and 1 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue