shrine 3.10.0 → 3.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5601661d53737bf3290ec5897dc9d33cfe5edac60a7468e67de7191649671a14
4
- data.tar.gz: bf2a26e2162a0c1805f2e8d174128e8ee5008060fdbbb9b8e358d41bfdf680a2
3
+ metadata.gz: '078c4711b7bd211c577666899edb233967df970a48b96d3b6239189f9c516586'
4
+ data.tar.gz: a46ed9608642d54c84fd80cc106e56655b4bff7439ff3cf2627bd1c199b40a15
5
5
  SHA512:
6
- metadata.gz: 7eb43ca8a78d4dedec0d24422ca4bc9f62eb6e454aa61ac7871760c4c398973a9787591295c39799f6b3250d4b3af9e80f7082c659fb6ed67435d775846ca5e2
7
- data.tar.gz: 636a7343486f6baaa3fa841abcef8439eb0df5d7183d6ac39a756a508de544dd356bca2562a9e01ac76b871a29455d2a40601f8086e8050dcc793bd57fc568e0
6
+ metadata.gz: 9526af08df019ad15b330e804d2136d0a2f876657b55018b3498ec5fd9c75b881ee1d7559fb4bd862512975d0a7439c4991d11dedf61b9c2bcc6d8c1c3ef38b6
7
+ data.tar.gz: af84847b2664f400250142bda5995b31d9303de422d5e73d75593ec2d9911f1cdc9e6dc27f10a3f97ab97aaefcb9ebf3f5754a35a6220501af2230dc7f7dcd6b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 3.10.1 (2026-10-10)
2
+
3
+ * `model` – Make `Attacher#write` a no-op when the attacher isn't backed by a model, fixing `remove_invalid` raising `NoMethodError` on attachers without a record (@janko)
4
+
1
5
  ## 3.10.0 (2026-09-20)
2
6
 
3
7
  * Add `fallback_storage` plugin for reading files from a secondary storage when they're missing in the primary storage (@yegorov, @janko)
data/doc/advantages.md CHANGED
@@ -389,19 +389,19 @@ and Active Storage.
389
389
 
390
390
  Uppy supports direct uploads to [AWS S3][Uppy AwsS3] or to a [custom
391
391
  endpoint][Uppy XHRUpload]. It also supports **resumable** uploads, either
392
- [directly to S3][Uppy AwsS3Multipart] or via the [tus protocol][tus]. For the
392
+ [directly to S3][Uppy AwsS3 multipart] or via the [tus protocol][tus]. For the
393
393
  UI you can choose from various components, ranging from a simple [status
394
394
  bar][Uppy StatusBar] to a full-featured [dashboard][Uppy Dashboard].
395
395
 
396
396
  Shrine provides server side components for each type of upload. They are built
397
397
  on top of Rack, so that they can be used with any Ruby web framework.
398
398
 
399
- | Uppy | Shrine |
400
- | :--- | :----- |
401
- | [XHRUpload][Uppy XHRUpload] | [`upload_endpoint`][upload_endpoint] |
402
- | [AwsS3][Uppy AwsS3] | [`presign_endpoint`][presign_endpoint] |
403
- | [AwsS3Multipart][Uppy AwsS3Multipart] | [`uppy-s3_multipart`][uppy-s3_multipart] |
404
- | [Tus][Uppy Tus] | [`tus-ruby-server`][tus-ruby-server] |
399
+ | Uppy | Shrine |
400
+ | :--- | :----- |
401
+ | [XHRUpload][Uppy XHRUpload] | [`upload_endpoint`][upload_endpoint] |
402
+ | [AwsS3][Uppy AwsS3] | [`presign_endpoint`][presign_endpoint] |
403
+ | [AwsS3 (multipart)][Uppy AwsS3 multipart] | [`uppy-s3_multipart`][uppy-s3_multipart] |
404
+ | [Tus][Uppy Tus] | [`tus-ruby-server`][tus-ruby-server] |
405
405
 
406
406
  [Rack]: https://rack.github.io
407
407
  [Sinatra]: http://sinatrarb.com
@@ -440,10 +440,10 @@ on top of Rack, so that they can be used with any Ruby web framework.
440
440
  [Uppy XHRUpload]: https://uppy.io/docs/xhr-upload/
441
441
  [Uppy AwsS3]: https://uppy.io/docs/aws-s3/
442
442
  [Uppy Tus]: https://uppy.io/docs/tus/
443
- [Uppy AwsS3Multipart]: https://uppy.io/docs/aws-s3-multipart/
443
+ [Uppy AwsS3 multipart]: https://uppy.io/docs/aws-s3/#shouldusemultipartfile
444
444
  [tus]: https://tus.io
445
- [Uppy StatusBar]: https://uppy.io/examples/statusbar/
446
- [Uppy Dashboard]: https://uppy.io/examples/dashboard/
445
+ [Uppy StatusBar]: https://uppy.io/docs/status-bar/
446
+ [Uppy Dashboard]: https://uppy.io/docs/dashboard/
447
447
  [tus-ruby-server]: https://github.com/janko/tus-ruby-server
448
448
  [uppy-s3_multipart]: https://github.com/janko/uppy-s3_multipart
449
449
  [backgrounding]: https://shrinerb.com/docs/plugins/backgrounding
data/doc/direct_s3.md CHANGED
@@ -174,11 +174,21 @@ and request headers.
174
174
  }
175
175
  ```
176
176
 
177
- Uppy's [AWS S3][uppy aws-s3] plugin would then make a request to this endpoint
178
- and use these parameters to upload the file directly to S3. Once the file has
179
- been uploaded, you can generate a JSON representation of the uploaded file on
180
- the client side, and write it to the hidden attachment field (or send it
181
- directly in an AJAX request).
177
+ Uppy's [AWS S3][uppy aws-s3] plugin in Companion mode will then fetch these
178
+ parameters from `<companionEndpoint>/s3/params` and use them to upload the file
179
+ directly to S3:
180
+
181
+ ```js
182
+ uppy.use(AwsS3, {
183
+ companionEndpoint: '', // relative to the current host
184
+ shouldUseMultipart: false, // Shrine's presign endpoint only signs single-request uploads
185
+ })
186
+ ```
187
+
188
+ Once the file has been uploaded, you can generate a JSON representation of the
189
+ uploaded file on the client side (the S3 object key is available as
190
+ `response.body.key` in the `upload-success` event), and write it to the hidden
191
+ attachment field (or send it directly in an AJAX request).
182
192
 
183
193
  ```rb
184
194
  {
@@ -203,8 +213,8 @@ as the [Roda][roda demo] / [Rails][rails demo] demo app for a complete example
203
213
  of multiple direct S3 uploads.
204
214
 
205
215
  Also, if you're dealing with larger files, you may want to make the uploads
206
- resumable by using the [AWS S3 Multipart][uppy aws-s3-multipart] Uppy plugin
207
- instead, with the [uppy-s3_multipart] gem on the backend. Your back-end
216
+ resumable by using Uppy's [AWS S3][uppy aws-s3-multipart] plugin in multipart
217
+ mode instead, with the [uppy-s3_multipart] gem on the backend. Your back-end
208
218
  implementation is similar, just using `Shrine.uppy_s3_multipart` in place of
209
219
  `Shrine.presign_endpoint`. Instructions can be found in the [gem
210
220
  docs][uppy-s3_multipart shrine].
@@ -396,8 +406,8 @@ setup] guide.
396
406
  [rails demo]: https://github.com/erikdahlstrand/shrine-rails-example
397
407
  [Uppy]: https://uppy.io
398
408
  [uppy aws-s3]: https://uppy.io/docs/aws-s3/
399
- [uppy aws-s3 cors]: https://uppy.io/docs/aws-s3/#S3-Bucket-configuration
400
- [uppy aws-s3-multipart]: https://uppy.io/docs/aws-s3/
409
+ [uppy aws-s3 cors]: https://uppy.io/docs/aws-s3/#bucket-and-cors-setup
410
+ [uppy aws-s3-multipart]: https://uppy.io/docs/aws-s3/#shouldusemultipartfile
401
411
  [uppy-s3_multipart]: https://github.com/janko/uppy-s3_multipart
402
412
  [uppy-s3_multipart shrine]: https://github.com/janko/uppy-s3_multipart#shrine
403
413
  [Amazon S3 Data Consistency Model]: http://docs.aws.amazon.com/AmazonS3/latest/dev/Introduction.html#ConsistencyMode
@@ -50,4 +50,4 @@ title: Extensions
50
50
  | [faster_s3_url](https://github.com/jrochkind/faster_s3_url) | Optimized generation of public and presigned AWS S3 GET URLs |
51
51
  | [imgproxy](https://github.com/imgproxy/imgproxy.rb) | Integration for [imgproxy](https://github.com/imgproxy/imgproxy) |
52
52
  | [rails_admin](https://github.com/sferik/rails_admin) | Integration for [RailsAdmin](https://github.com/sferik/rails_admin) |
53
- | [uppy-s3_multipart](https://github.com/janko/uppy-s3_multipart) | Integration for [Uppy AWS S3 Multipart](https://uppy.io/docs/aws-s3-multipart/) |
53
+ | [uppy-s3_multipart](https://github.com/janko/uppy-s3_multipart) | Integration for [Uppy AWS S3](https://uppy.io/docs/aws-s3/) multipart uploads |
@@ -896,13 +896,13 @@ on slow and flaky internet connections.
896
896
 
897
897
  #### Uppy S3 Multipart
898
898
 
899
- You can achieve resumable uploads directly to S3 with the [AWS S3
900
- Multipart][uppy aws-s3-multipart] Uppy plugin, accompanied with
899
+ You can achieve resumable uploads directly to S3 with Uppy's [AWS S3][uppy
900
+ aws-s3-multipart] plugin in multipart mode, accompanied with the
901
901
  `uppy_s3_multipart` Shrine plugin provided by the [uppy-s3_multipart] gem.
902
902
 
903
903
  ```rb
904
904
  # Gemfile
905
- gem "uppy-s3_multipart", "~> 0.3"
905
+ gem "uppy-s3_multipart", "~> 1.3"
906
906
  ```
907
907
  ```rb
908
908
  Shrine.plugin :uppy_s3_multipart
@@ -1108,7 +1108,7 @@ Shrine.logger.level = Logger::WARN
1108
1108
  [Uppy]: https://uppy.io
1109
1109
  [shrine-tus]: https://github.com/shrinerb/shrine-tus
1110
1110
  [tus]: https://tus.io
1111
- [uppy aws-s3-multipart]: https://uppy.io/docs/aws-s3-multipart/
1111
+ [uppy aws-s3-multipart]: https://uppy.io/docs/aws-s3/#shouldusemultipartfile
1112
1112
  [uppy aws-s3]: https://uppy.io/docs/aws-s3/
1113
1113
  [uppy tus]: https://uppy.io/docs/tus/
1114
1114
  [uppy xhr-upload]: https://uppy.io/docs/xhr-upload/
@@ -0,0 +1,15 @@
1
+ ---
2
+ title: Shrine 3.10.1
3
+ ---
4
+
5
+ ## Bug fixes
6
+
7
+ * Since Shrine 3.9.0, the `remove_invalid` plugin would raise `NoMethodError` when validation failed on an attacher without a record and the `model` plugin was loaded (directly or through the `activerecord`/`sequel` plugins).
8
+
9
+ ```rb
10
+ attacher = Shrine::Attacher.new
11
+ attacher.assign(invalid_file)
12
+ # NoMethodError: undefined method '=' for nil
13
+ ```
14
+
15
+ `Attacher#write` from the `model` plugin is now a no-op when the attacher isn't backed by a model, so the invalid file is removed and validation errors are kept as before.
@@ -122,12 +122,15 @@ class Shrine
122
122
  # Writes uploaded file data into the model.
123
123
  def set(*)
124
124
  result = super
125
- write if model?
125
+ write
126
126
  result
127
127
  end
128
128
 
129
- # Writes the attachment data into the model attribute.
129
+ # Writes the attachment data into the model attribute. Does nothing
130
+ # when the attacher isn't backed by a model instance.
130
131
  def write
132
+ return unless model?
133
+
131
134
  column_values.each do |name, value|
132
135
  write_attribute(name, value)
133
136
  end
@@ -8,7 +8,7 @@ class Shrine
8
8
  module VERSION
9
9
  MAJOR = 3
10
10
  MINOR = 10
11
- TINY = 0
11
+ TINY = 1
12
12
  PRE = nil
13
13
 
14
14
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shrine
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.0
4
+ version: 3.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
@@ -490,6 +490,7 @@ files:
490
490
  - doc/release_notes/3.0.1.md
491
491
  - doc/release_notes/3.1.0.md
492
492
  - doc/release_notes/3.10.0.md
493
+ - doc/release_notes/3.10.1.md
493
494
  - doc/release_notes/3.2.0.md
494
495
  - doc/release_notes/3.2.1.md
495
496
  - doc/release_notes/3.2.2.md