mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Fix #4629 (Nook can't open files with "#" in name)
This commit is contained in:
parent
d61af79c8c
commit
85b0260156
@ -86,4 +86,5 @@ class NOOK(USBMS):
|
||||
|
||||
return drives
|
||||
|
||||
|
||||
def sanitize_path_components(self, components):
|
||||
return [x.replace('#', '_') for x in components]
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user