-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow uploading IO objects with unknown size
Currently Shrine requires all IO objects to respond to #size. This is not necessary, because storages like FileSystem and S3 allow uploading IO objects of unknown size (with some modifications). The size of the IO object can be unknown if it's a pipe, socket, or a general stream of data. We remove #size from the required IO methods. We also deprecates the Shrine::IO_METHODS constant, because now that it's public we cannot remove :size from it without affecting backwards compatibility. Shrine::IO_METHODS will be private in Shrine 3. We modify S3 storage to use multipart upload in case the size is unknown. There is aws/aws-sdk-ruby#1711 which adds Aws::S3::Object#upload_stream, but it hasn't been merged yet at this moment, and we unfortunately don't control aws-sdk-s3 version so we have to support older versions anyway. We also modify FileSystem and S3 storages to backfill the "size" metadata of the IO object in case it's not known. Fixes #252
- Loading branch information
Showing
11 changed files
with
288 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.