mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 04:43:41 +02: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
1 changed files with 8 additions and 0 deletions
|
|
@ -711,6 +711,14 @@ def create_upload_path(self, path, mdata, fname):
|
|||
fname = sanitize(fname)
|
||||
extra_components.append(fname)
|
||||
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)
|
||||
filepath = os.path.join(path, *components)
|
||||
filedir = os.path.dirname(filepath)
|
||||
|
|
|
|||
Loading…
Reference in a new issue