carrierwave-base64 2.0 → 2.1

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
  SHA1:
3
- metadata.gz: d1d28a4da389c8687996eda978729b5e8fa1ac7c
4
- data.tar.gz: a8c89f791ba70a0e43dfce8d7e3abb5350018d9f
3
+ metadata.gz: bd170fa5ae07d088cbe54f9553c9497db056d54a
4
+ data.tar.gz: a6edda1a04bc09277a61832ed170e4ea0bcc41d3
5
5
  SHA512:
6
- metadata.gz: bcab8ef41367ab48869963bc1cc6f08a6b5955f085edf7feb4d4aeaf34c05e3cef00274066d5fd5822fcac3403521f92458c2e4935e9423dffd591d20fec9cee
7
- data.tar.gz: 7a2ecfb2e5ba4b94c7ad197d54d477fc9bd75d4353167671025759bb4b3d4832b3ef1534ff78390de77723689f27066b431a4df891b7629c1ffc24738997cca4
6
+ metadata.gz: ff0a8c13748d7aaabec2cdb064a082653bde2bcd17be7aa4ab3f027ef2b5235cdc69dd2f66f5b8249f3e8e711694b3b85d46020967c70ec368e25f8eff691b80
7
+ data.tar.gz: e7e46931cc24bebfa3b5d1984e24fe58ee9c374634026445bed2176d245f2f1556c771a20bcbbcd1f2c48f16a4def054fee262385451072d653dd02527785a94
@@ -5,9 +5,12 @@ module Carrierwave
5
5
  mount_uploader attribute, uploader_class, options
6
6
 
7
7
  define_method "#{attribute}=" do |data|
8
+ if data.present? && send("#{attribute}").blank?
9
+ send "#{attribute}_will_change!"
10
+ end
11
+
8
12
  if data.present? && data.is_a?(String) && data.strip.start_with?("data")
9
13
  super(Carrierwave::Base64::Base64StringIO.new(data.strip))
10
- send "#{attribute}_will_change!"
11
14
  else
12
15
  super(data)
13
16
  end
@@ -1,5 +1,5 @@
1
1
  module Carrierwave
2
2
  module Base64
3
- VERSION = "2.0"
3
+ VERSION = "2.1"
4
4
  end
5
5
  end
data/spec/adapter_spec.rb CHANGED
@@ -17,6 +17,7 @@ RSpec.describe Carrierwave::Base64::Adapter do
17
17
  sham_rack_app = ShamRack.at('www.example.com').stub
18
18
  sham_rack_app.register_resource("/test.jpg", file_path("fixtures", "test.jpg"), "images/jpg")
19
19
  subject[:image] = "test.jpg"
20
+ expect(subject.changed?).to be_truthy
20
21
  subject.save!
21
22
  subject.reload
22
23
  expect(subject.image.current_path).to eq file_path("../uploads", "test.jpg")
@@ -1 +1 @@
1
- data:image/jpg;base64,/9j/4AAQSkZJRgYN9pQYSVQOD7GuSeR8tSjOKutFJfrq//2Q==
1
+ data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: carrierwave-base64
3
3
  version: !ruby/object:Gem::Version
4
- version: '2.0'
4
+ version: '2.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yury Lebedev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-11 00:00:00.000000000 Z
11
+ date: 2015-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave