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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6b7f164c614c501edd82cdc4f902e3cbf830a67
|
4
|
+
data.tar.gz: 6330e788f837fdf14cac8f330f3c2403a3b9ebea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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)
|
@@ -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 "
|
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 "
|
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.
|
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-
|
11
|
+
date: 2015-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|