mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #2808 (PRS-505 upload does not handle long titles well)
This commit is contained in:
parent
491d21f704
commit
85bdb2d9a9
@ -37,6 +37,9 @@ class CLI(object):
|
|||||||
path = os.path.join(path, infile.name)
|
path = os.path.join(path, infile.name)
|
||||||
if not replace_file and os.path.exists(path):
|
if not replace_file and os.path.exists(path):
|
||||||
raise PathError('File already exists: ' + path)
|
raise PathError('File already exists: ' + path)
|
||||||
|
d = os.path.dirname(path)
|
||||||
|
if not os.path.exists(d):
|
||||||
|
os.makedirs(d)
|
||||||
dest = open(path, 'wb')
|
dest = open(path, 'wb')
|
||||||
shutil.copyfileobj(infile, dest, 10*1024*1024)
|
shutil.copyfileobj(infile, dest, 10*1024*1024)
|
||||||
dest.flush()
|
dest.flush()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user