Cogniac / cogniac-sdk-py

Python SDK for Cogniac Public API
Apache License 2.0
5 stars 6 forks source link

multi-part upload check not performed if file pointer is used to upload media. #95

Open spatel-cog opened 3 years ago

spatel-cog commented 3 years ago

Edgeflow uploader uses a file pointer to create media for uploading to cloudcore.

The check below uses the absence of a file pointer to determine file size and subsequently trigger a multipart upload. https://github.com/Cogniac/cogniac-sdk-py/blob/213e6df4348c7fa00af6b5ead37dbcd52d9edd8a/cogniac/media.py#L219

When the length of the media exceeds 16MB using non-multipart, the Public API rejects the request.

Options: 1) create a tmp file in uploader 2) modify the create_media API to handle file size checks for file pointers. This gets tricky as the only way to determine file length is to use fseek, ftell and then fseek back to the beginning. Alternative is to pass in the media length to the create_media API.