Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request updates file handling in the
store_file
method for both PostgreSQL and S3 providers to improve compatibility and correctness when working with binary file streams. The key changes include switching fromio.BytesIO
/BytesIO
to the more generalBinaryIO
type and updating file size calculation logic for PostgreSQL.Use BytesIO for small in-memory buffers; switch to file-based BinaryIO for large files.
Changes to file handling:
py/core/providers/file/postgres.py
:file_content
parameter instore_file
and_write_lobject
methods fromio.BytesIO
toBinaryIO
for broader compatibility with binary streams. [1] [2]store_file
to useseek
andtell
instead ofgetbuffer().nbytes
, ensuring compatibility with anyBinaryIO
implementation.py/core/providers/file/s3.py
:file_content
parameter in thestore_file
method fromBytesIO
toBinaryIO
to align with the PostgreSQL provider and support a wider range of binary file streams.Important
Update
store_file
methods in PostgreSQL and S3 providers to useBinaryIO
for better binary stream compatibility.postgres.py
: Changedfile_content
type instore_file
and_write_lobject
fromio.BytesIO
toBinaryIO
. Updated file size calculation instore_file
to useseek
andtell
.s3.py
: Changedfile_content
type instore_file
fromBytesIO
toBinaryIO
.This description was created by
for fbbc488. You can customize this summary. It will automatically update as commits are pushed.