Skip to content

Fix missing contentLength in S3 driver listAll by mapping from Size#16

Open
necessarylion wants to merge 2 commits intoflydrive-js:2.xfrom
necessarylion:2.x
Open

Fix missing contentLength in S3 driver listAll by mapping from Size#16
necessarylion wants to merge 2 commits intoflydrive-js:2.xfrom
necessarylion:2.x

Conversation

@necessarylion
Copy link
Copy Markdown

Summary

Fix an issue where contentLength was missing in the S3 driver listAll method.

According to the AWS SDK documentation, ListObjectsV2Command returns objects of type _Object, which do not include a ContentLength field. Instead, the object size is provided through the Size property.

Because of this, the contentLength field was not being populated correctly.

Changes

  • Map Size from the ListObjectsV2Command response to contentLength in the S3 driver #createFileMetaData method.

Reference

AWS SDK documentation:
https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/s3/command/ListObjectsV2Command/

_Object structure returned in Contents:

  • Size → object size in bytes
  • ContentLength is not included in this response

Impact

Ensures contentLength is correctly returned when listing objects from S3 using the listAll method.

@thetutlage
Copy link
Copy Markdown
Collaborator

Thanks for the PR! Could you please add a test covering this fix? We'd like to see a test that verifies contentLength is correctly populated from the Size property when using listAll. We'll review the PR once that's in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants