mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Remove trailing periods from path components when sending books to devices. Fixes #3475 (No books in Collection on Sony PRS-300)
This commit is contained in:
parent
d147f56646
commit
60c3a5c5f8
@ -711,6 +711,14 @@ class Device(DeviceConfig, DevicePlugin):
|
|||||||
fname = sanitize(fname)
|
fname = sanitize(fname)
|
||||||
extra_components.append(fname)
|
extra_components.append(fname)
|
||||||
extra_components = [str(x) for x in extra_components]
|
extra_components = [str(x) for x in extra_components]
|
||||||
|
def remove_trailing_periods(x):
|
||||||
|
ans = x
|
||||||
|
while ans.endswith('.'):
|
||||||
|
ans = ans[:-1]
|
||||||
|
if not ans:
|
||||||
|
ans = 'x'
|
||||||
|
return ans
|
||||||
|
extra_components = list(map(remove_trailing_periods, extra_components))
|
||||||
components = shorten_components_to(250 - len(path), extra_components)
|
components = shorten_components_to(250 - len(path), extra_components)
|
||||||
filepath = os.path.join(path, *components)
|
filepath = os.path.join(path, *components)
|
||||||
filedir = os.path.dirname(filepath)
|
filedir = os.path.dirname(filepath)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user