alchemy-dragonfly-s3 4.0.4 → 4.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b874666e4ea078bbbd88849204a3817c5460d3578a30b9a5e6ecbef8a411912
4
- data.tar.gz: b755cef56da8ba88634bf18b07571c21c4d7d43e37d331697893fceb15d1bd80
3
+ metadata.gz: 6256465573974ec82c6ceee7c1b72484bce11c7194151f571718fd48b763f482
4
+ data.tar.gz: 0b2b2e665659e02c81754287efb25e4025a678efceba5ae28462bac22faeb43a
5
5
  SHA512:
6
- metadata.gz: 65e050d8241328e3d1daac76e8eeb0cb83022216be1f1534ec98e7a93d25b4e04e9fceccd9db0b6a005cf528281256288d32d573fefcaec4c8209661ee66aff2
7
- data.tar.gz: 4b10af37543c65d84ae518a2e14fbeacb60436a9f59cf486c49ce8c6ad49679b08636300f4ade1d273288acf2c7785e241678dfd4bfe564886ae2b4950906a23
6
+ metadata.gz: 3c3b5d672dde007412c96d300b7c533d13897f805877d42e1242c33e72e65d1e319214cebab1a86f806f9007fb20c2f24aee05b7fb2120ae3577a14663c5784a
7
+ data.tar.gz: 87bac607d1459905241d76e77167c668c1c1a7a5cc10ffd85754f41a1ead60df500211d784c76d5eacac9455f8e39ddf06bc18e4df6fe514880aa04c56e01f30
@@ -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 = "4.0.4"
6
+ VERSION = "4.0.5"
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: 4.0.4
4
+ version: 4.0.5
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