2.6.1.md

doc/release_notes/2.6.1.md
Last Update: 2023-07-30 18:26:06 +0200

title: Shrine 2.6.1

Bug fixes

  • When download_endpoint streams file content into the response body, with certain storages (FileSystem, SQL) it will use a buffer object when reading each chunk, which will make that, instead of each read chunk allocating a new string object, ever new chunk is read into the same buffer string object, replacing the content from the previous chunk.

Unfortunately, there are some parts of the Rack/Rails stack which rely on all chunks co-existing in the memory at the same time (for example the Rack::ContentLenth middleware). For that reason, and to be consistent in behaviour and memory usage when used with other storages (S3), we modify download_endpoint not to use the buffer object, and have each read chunk be a new string object.