glacier-upload icon indicating copy to clipboard operation
glacier-upload copied to clipboard

Unable to upload small files to glacier

Open lyenliang opened this issue 4 years ago • 1 comments

I got the following error when uploading a file whose size is less than 4MB

botocore.errorfactory.InvalidParameterValueException: An error occurred (InvalidParameterValueException) when calling the UploadArchive operation: Invalid Content-Length: 0

This error happens at line 70 of upload.py, which is body=file_to_upload,.

The problem seems to be related to file_size = file_to_upload.seek(0, 2) line in upload.py.

Because after I change it to file_size = 1, the problem no longer occurs.

lyenliang avatar Jun 15 '20 08:06 lyenliang

replace

file_size = file_to_upload.seek(0, 2)

with

import os

file_size = os.stat(file_name[0]).st_size

awaismehmood88 avatar Jul 12 '20 16:07 awaismehmood88