Skip to content
Snippets Groups Projects
Commit 1a390558 authored by Aurélien Dunand's avatar Aurélien Dunand Committed by Seblu
Browse files

Copy file from http without read it in one time


When huge payload was read, it could cause Out Of Memory error.
Use istools copyfileobj for read chunk by chunk.

Signed-off-by: default avatarSeblu <sebastien.luttringer@smartjog.com>
parent a164cd39
No related branches found
No related tags found
No related merge requests found
......@@ -60,7 +60,7 @@ def copy(source, destination, uid=None, gid=None, mode=None, timeout=None):
elif (stype == "http" or stype == "ftp") and dtype == "file":
f_dest = open(destination, "w")
f_source = urllib2.urlopen(source, timeout=timeout)
f_dest.write(f_source.read())
copyfileobj(f_source, f_dest)
elif stype == "file" and dtype == "":
raise NotImplementedError
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment