carrierwave-base64 1.2 → 1.3

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: 78544f123acc76828d99b2cb7db97fffa72d43f6
4
- data.tar.gz: 8565d4d58435f7aeff186004bf30905268a61c4d
3
+ metadata.gz: f6b7f164c614c501edd82cdc4f902e3cbf830a67
4
+ data.tar.gz: 6330e788f837fdf14cac8f330f3c2403a3b9ebea
5
5
  SHA512:
6
- metadata.gz: 100c500e057004e05ddb50017ecd187655190756298812248a20268d01d093d5a6dfdf10ddfa825ca3b8d5b5bd97d0090f02c90c41863029ebfd56fb8f4de0cd
7
- data.tar.gz: 4292b7cb21d20148585c43b7f3428ecf2c57f539afb3ed5a50e988ae95507612705ca58b030bc37694b76dc5b53a90f43c1fd8ba8763fc59061e9a7b8aa158f1
6
+ metadata.gz: 13b57035d23637c2baa0fcd87a5cb47d9bdb5849e5550c046ce768370dbcaa3c1bdf75dd7b49aced83dbb4438e3f0c970798cbe6a9a5dc3970597b8b6033d93e
7
+ data.tar.gz: 24efd2af689ccab46857d7047ab252ab2ec2f06aee343ff825bebb15b2da4120f1a39a6366f2c3701db63239c3fef5578ea52e1b83299f46aa7486fd4094a99c
@@ -7,7 +7,7 @@ module Carrierwave
7
7
  mount_uploader attribute, uploader_class
8
8
 
9
9
  define_method "#{attribute}=" do |data|
10
- if data.present? && data.is_a?(String) && data.strip.end_with?("==")
10
+ if data.present? && data.is_a?(String) && data.strip.start_with?("data:image")
11
11
  super(Carrierwave::Base64::Base64StringIO.new(data.strip))
12
12
  else
13
13
  super(data)
@@ -1,5 +1,5 @@
1
1
  module Carrierwave
2
2
  module Base64
3
- VERSION = "1.2"
3
+ VERSION = "1.3"
4
4
  end
5
5
  end
@@ -15,7 +15,7 @@ RSpec.describe Carrierwave::Base64::ActiveRecord do
15
15
  expect(subject.image).to be_an_instance_of(uploader)
16
16
  end
17
17
 
18
- it "should work with normal file uploads" do
18
+ it "handles normal file uploads" do
19
19
  sham_rack_app = ShamRack.at('www.example.com').stub
20
20
  sham_rack_app.register_resource("/test.jpg", file_path("fixtures", "test.jpg"), "images/jpg")
21
21
  subject[:image] = "test.jpg"
@@ -24,18 +24,11 @@ RSpec.describe Carrierwave::Base64::ActiveRecord do
24
24
  expect(subject.image.current_path).to eq file_path("../uploads", "test.jpg")
25
25
  end
26
26
 
27
- it "should work with base64 file uploads" do
27
+ it "handles data-urls" do
28
28
  subject.image = File.read(file_path("fixtures", "base64_image.fixture")).strip
29
29
  subject.save!
30
30
  subject.reload
31
31
  expect(subject.image.current_path).to eq file_path("../uploads", "image.jpg")
32
32
  end
33
-
34
- it "should work with base64 file uploads with trailing newline" do
35
- subject.image = File.read(file_path("fixtures", "base64_image.fixture"))
36
- subject.save!
37
- subject.reload
38
- expect(subject.image.current_path).to eq file_path("../uploads", "image.jpg")
39
- end
40
33
  end
41
34
  end
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: '1.2'
4
+ version: '1.3'
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-02-17 00:00:00.000000000 Z
11
+ date: 2015-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave