Fix #4629 (Nook can't open files with "#" in name)

This commit is contained in:
Kovid Goyal 2010-01-21 10:45:29 -07:00
parent d61af79c8c
commit 85b0260156
2 changed files with 10 additions and 1 deletions

View File

@ -86,4 +86,5 @@ class NOOK(USBMS):
return drives
def sanitize_path_components(self, components):
return [x.replace('#', '_') for x in components]

View File

@ -782,6 +782,13 @@ class Device(DeviceConfig, DevicePlugin):
'''
return default
def sanitize_path_components(self, components):
'''
Perform any device specific sanitization on the path components
for files to be uploaded to the device
'''
return components
def create_upload_path(self, path, mdata, fname):
path = os.path.abspath(path)
extra_components = []
@ -834,6 +841,7 @@ class Device(DeviceConfig, DevicePlugin):
extra_components = list(map(remove_trailing_periods, extra_components))
components = shorten_components_to(250 - len(path), extra_components)
components = self.sanitize_path_components(components)
filepath = os.path.join(path, *components)
filedir = os.path.dirname(filepath)