OCI Object Storage Upload scenarios with 'Invalid Content-Length' scenarios While Using Python SDK
I'm trying to upload a file to Oracle Cloud Infrastructure (OCI) Object Storage using the Python SDK (version 2.54.0), but I'm working with an 'Invalid Content-Length' behavior. The behavior message I'm receiving is: `Invalid Content-Length: <actual_length> for file <file_path>`. I've double-checked the length of the file I'm attempting to upload, and it seems correct. Here is the code snippet that I'm using to perform the upload: ```python import oci config = oci.config.from_file() # Load configuration from default file object_storage = oci.object_storage.ObjectStorageClient(config) namespace = object_storage.get_namespace().data bucket_name = 'my_bucket' file_path = '/path/to/my/file.txt' with open(file_path, 'rb') as file_data: object_storage.put_object( namespace, bucket_name, 'file.txt', file_data, content_length=os.path.getsize(file_path) ) ``` I've ensured that the `content_length` parameter matches the actual size of the file by using `os.path.getsize(file_path)`. However, I'm still getting the behavior. I've also confirmed that the bucket exists and that I have the necessary permissions to upload files to it. To troubleshoot further, I added some print statements to log the size of the file and the value of `content_length`: ```python print(f'File Size: {os.path.getsize(file_path)}') print(f'Content-Length: {content_length}') ``` This confirmed that both values are identical, yet the behavior continues. Could there be an scenario with how Iām opening the file or perhaps something related to the SDK itself? Any insights would be greatly appreciated! Is there a better approach? Am I missing something obvious?