mirror of https://github.com/docker/docker-py.git
fix docker build error when dockerfile contains unicode character.
if dockerfile contains unicode character,len(contents) will return character length,this length will less than len(contents_encoded) length,so contants data will be truncated. Signed-off-by: fengbaolong <fengbaolong@hotmail.com>
This commit is contained in:
parent
d0467badfb
commit
9f5e35f5fe
|
@ -105,8 +105,9 @@ def create_archive(root, files=None, fileobj=None, gzip=False,
|
|||
|
||||
for name, contents in extra_files:
|
||||
info = tarfile.TarInfo(name)
|
||||
info.size = len(contents)
|
||||
t.addfile(info, io.BytesIO(contents.encode('utf-8')))
|
||||
contents_encoded = contents.encode('utf-8')
|
||||
info.size = len(contents_encoded)
|
||||
t.addfile(info, io.BytesIO(contents_encoded))
|
||||
|
||||
t.close()
|
||||
fileobj.seek(0)
|
||||
|
|
Loading…
Reference in New Issue