Only pre-allocate up to 5MB from big files

This commit is contained in:
shortcutme 2018-07-16 01:34:21 +02:00
parent b1575a979e
commit 1296ab9b60
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -389,7 +389,7 @@ class SiteStoragePlugin(object):
os.makedirs(file_dir) os.makedirs(file_dir)
f = open(file_path, 'wb') f = open(file_path, 'wb')
f.truncate(size) f.truncate(min(1024 * 1024 * 5, size)) # Only pre-allocate up to 5MB
f.close() f.close()
if os.name == "nt": if os.name == "nt":
startupinfo = subprocess.STARTUPINFO() startupinfo = subprocess.STARTUPINFO()