Fix #2808 (PRS-505 upload does not handle long titles well)

This commit is contained in:
Kovid Goyal 2009-07-29 10:49:09 -06:00
parent 491d21f704
commit 85bdb2d9a9

View File

@ -37,6 +37,9 @@ class CLI(object):
path = os.path.join(path, infile.name)
if not replace_file and os.path.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')
shutil.copyfileobj(infile, dest, 10*1024*1024)
dest.flush()