carrierwave-base64 2.6.0 → 2.6.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/carrierwave-base64.gemspec +2 -0
- data/lib/carrierwave/base64/base64_string_io.rb +4 -1
- data/lib/carrierwave/base64/version.rb +1 -1
- data/spec/base64_string_io_spec.rb +4 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abcbb4f3923aeaab3fe9826578380b8ac0834507
|
4
|
+
data.tar.gz: 4e6a9110f48465cae3cd17934c7c6327610f59dc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a63f9c999f435e3f0ab00eb526c9998538bdb722f5724c250e6761d32e8d9ab3ce4bcdbb16f1f97683b530c0517f482045b2bb5dea7fcf694556785bcad9699
|
7
|
+
data.tar.gz: b4d47fcf52dc1a2cc6093d965780168de83ba07d12a36b2d5b8edb2f43363053e10a1433ed24a3568f2e6ac2e7c5ce83ff5eca655abc338f01c9cdf08cc3e5dd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# carrierwave-base64 changelog
|
2
2
|
|
3
|
+
## 2.6.1
|
4
|
+
|
5
|
+
This release fixes the issue that the public API of the gem was changed in 2.6.0, by switching from RFC 2045 to RFC 4648 standard for base64 strings.
|
6
|
+
|
7
|
+
- Switched back to RFC 2045 standard for base64 strings (@lebedev-yury)
|
8
|
+
|
3
9
|
## 2.6.0
|
4
10
|
|
5
11
|
- Fixed the issue with base64 string not being validated (#64, @sjdrabbani)
|
data/carrierwave-base64.gemspec
CHANGED
@@ -6,9 +6,12 @@ module Carrierwave
|
|
6
6
|
def initialize(encoded_file, file_name)
|
7
7
|
description, encoded_bytes = encoded_file.split(',')
|
8
8
|
|
9
|
+
raise ArgumentError unless encoded_bytes
|
10
|
+
raise ArgumentError if encoded_bytes.eql?('(null)')
|
11
|
+
|
9
12
|
@file_name = file_name
|
10
13
|
@file_extension = get_file_extension description
|
11
|
-
bytes = ::Base64.
|
14
|
+
bytes = ::Base64.decode64 encoded_bytes
|
12
15
|
|
13
16
|
super bytes
|
14
17
|
end
|
@@ -3,7 +3,7 @@ RSpec.describe Carrierwave::Base64::Base64StringIO do
|
|
3
3
|
image/jpeg application/pdf audio/mpeg].each do |content_type|
|
4
4
|
context "correct #{content_type} data" do
|
5
5
|
let(:data) do
|
6
|
-
"data:#{content_type};base64
|
6
|
+
"data:#{content_type};base64,/9j/4AAQSkZJRgABAQEASABKdhH//2Q=="
|
7
7
|
end
|
8
8
|
|
9
9
|
let(:file_extension) do
|
@@ -36,22 +36,16 @@ RSpec.describe Carrierwave::Base64::Base64StringIO do
|
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'invalid image data' do
|
39
|
-
it 'raises
|
39
|
+
it 'raises ArgumentError for invalid image data' do
|
40
40
|
expect do
|
41
41
|
described_class.new('/9j/4AAQSkZJRgABAQEASABIAADKdhH//2Q==', 'file')
|
42
|
-
end.to raise_error(
|
42
|
+
end.to raise_error(ArgumentError)
|
43
43
|
end
|
44
44
|
|
45
45
|
it 'raises ArgumentError if base64 data equals to (null)' do
|
46
46
|
expect do
|
47
47
|
described_class.new('data:image/jpeg;base64,(null)', 'file')
|
48
|
-
end.to raise_error(ArgumentError
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'raises ArgumentError if base64 data contains white space' do
|
52
|
-
expect do
|
53
|
-
described_class.new 'data:image/jpeg;base64,VGhpcyBpc yB0Z==', 'file'
|
54
|
-
end.to raise_error(ArgumentError, 'invalid base64')
|
48
|
+
end.to raise_error(ArgumentError)
|
55
49
|
end
|
56
50
|
end
|
57
51
|
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: 2.6.
|
4
|
+
version: 2.6.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: 2017-10-
|
11
|
+
date: 2017-10-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: carrierwave
|