alchemy-dragonfly-s3 5.0.5 → 5.0.6

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: 02d80fac356bf2e699b152896713ac7731cb23f0a1e26b0b6eba79648c90236d
4
- data.tar.gz: fbbe2ced0c05ff53e75df1cd39a3d7b754dad998c0230a896b9ceadae2e3864b
3
+ metadata.gz: fd52621f3cabb437a417a753748da31392a0b640a779701239a62a53ea27bd9a
4
+ data.tar.gz: f1e3494d61ceea61d20c42b55d8a63a4822ed4290a13e69496b20cb3a70de588
5
5
  SHA512:
6
- metadata.gz: f9af0f1daaeedc925e70fe185968e7ea02f93f10d8dce08a06c0360e30445bbefe0bdceade9c99e9f7c6c616cb83f5699fadce2a0214121a8f486c0c23031dbb
7
- data.tar.gz: 4f2ffac175138c3f792615c20d14c32724c79f922f16bb993d94af2f441a2c17585716b89160d7ea2927c9afc319004e3dc79b976485f2d6e7ca3ac45293b85a
6
+ metadata.gz: f2f6450f5ea35d076f86390f91916e655cc39854d133f51cde2a07951b8fcd61e9f93ad3e53b17536a4e21f7918b716b65e6b6b72b8866ce28145130369e0e99
7
+ data.tar.gz: bf2d9c707d32ed7419d0544618754759d8bdf1ba97cf199d3696c105eed47dd67bb9d3c4ee66c8d956403863c84d402cf9c8c4fe18d2ddb001bc50af684acef5
@@ -5,13 +5,23 @@ module Alchemy
5
5
  #
6
6
  class Create
7
7
  def self.call(variant, signature, uid)
8
- image = variant.image
9
- image.store(path: uid)
10
- variant.picture.thumbs.create!(
8
+ # create the thumb before uploading
9
+ # to prevent db race conditions
10
+ thumb = variant.picture.thumbs.create!(
11
11
  picture: variant.picture,
12
12
  signature: signature,
13
13
  uid: uid,
14
14
  )
15
+ begin
16
+ # fetch and process the image
17
+ image = variant.image
18
+ # upload the processed image
19
+ image.store(path: uid)
20
+ rescue RuntimeError, Excon::Error => e
21
+ Rails.logger.warn(e)
22
+ # destroy the thumb if processing or upload fails
23
+ thumb.destroy
24
+ end
15
25
  end
16
26
  end
17
27
  end
@@ -91,7 +91,7 @@ module Alchemy
91
91
 
92
92
  encoding_options = []
93
93
 
94
- convert_format = render_format != picture.image_file_format.sub("jpeg", "jpg")
94
+ convert_format = render_format.sub("jpeg", "jpg") != picture.image_file_format.sub("jpeg", "jpg")
95
95
 
96
96
  if render_format =~ /jpe?g/ && convert_format
97
97
  quality = options[:quality] || Config.get(:output_image_jpg_quality)
@@ -3,7 +3,7 @@
3
3
  module Alchemy
4
4
  module Dragonfly
5
5
  module S3
6
- VERSION = "5.0.5"
6
+ VERSION = "5.0.6"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-dragonfly-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.5
4
+ version: 5.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-17 00:00:00.000000000 Z
11
+ date: 2020-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms