Don't verify hash of uploaded files
I believe this is a bug in `libcloud`. We're passing an iterator (as required by libcloud -- https://github.com/apache/libcloud/blob/trunk/libcloud/storage/base.py#L592) for the stream, but when verifying the hash of the uploaded file, `libcloud` goes through the stream twice: https://github.com/apache/libcloud/blob/trunk/libcloud/storage/base.py#L614-L621 After the sending the file stream as an upload, when generating the hash, the iterator has already been iterated through so the second go-through returns an empty iterator. Thus, the hash will never match unless an empty file is uploaded. This change reaches into the container's driver so that we can pass the `verify_hash` kwarg, which cannot be specified on the container's methods.
This commit is contained in:
parent
1594103847
commit
4e16346ed4
@ -26,9 +26,11 @@ class Uploader:
|
|||||||
)
|
)
|
||||||
|
|
||||||
object_name = uuid4().hex
|
object_name = uuid4().hex
|
||||||
self.container.upload_object_via_stream(
|
self.container.driver._put_object(
|
||||||
iterator=fyle.stream.__iter__(),
|
stream=iter(fyle.stream),
|
||||||
|
container=self.container,
|
||||||
object_name=object_name,
|
object_name=object_name,
|
||||||
|
verify_hash=False,
|
||||||
extra={"acl": "private"},
|
extra={"acl": "private"},
|
||||||
)
|
)
|
||||||
return (fyle.filename, object_name)
|
return (fyle.filename, object_name)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user