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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb281b2683a576956173494d155b372c985499a8
4
- data.tar.gz: e28479d1490ba1a00ce8e20a862f9636fa1f78f5
3
+ metadata.gz: abcbb4f3923aeaab3fe9826578380b8ac0834507
4
+ data.tar.gz: 4e6a9110f48465cae3cd17934c7c6327610f59dc
5
5
  SHA512:
6
- metadata.gz: f102337cef6625d4ec0ea0e281c1d4e0ff57af69d9778d0b8073e4379f1fcea9ef2212002683f92643b83b7ddd03a3bf1e8c18aec92908485a709e6beb1b1098
7
- data.tar.gz: 7e18c8cc657eebcb475caf0b6e0c5a541ada043ebb09b5506354b49b0ae427ba5f0ba1c4055c2970ecc1080148852d77c6cc65a13df11759fe9199b33e899279
6
+ metadata.gz: 7a63f9c999f435e3f0ab00eb526c9998538bdb722f5724c250e6761d32e8d9ab3ce4bcdbb16f1f97683b530c0517f482045b2bb5dea7fcf694556785bcad9699
7
+ data.tar.gz: b4d47fcf52dc1a2cc6093d965780168de83ba07d12a36b2d5b8edb2f43363053e10a1433ed24a3568f2e6ac2e7c5ce83ff5eca655abc338f01c9cdf08cc3e5dd
@@ -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)
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  lib = File.expand_path('../lib', __FILE__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
 
@@ -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.strict_decode64 encoded_bytes
14
+ bytes = ::Base64.decode64 encoded_bytes
12
15
 
13
16
  super bytes
14
17
  end
@@ -1,5 +1,5 @@
1
1
  module Carrierwave
2
2
  module Base64
3
- VERSION = '2.6.0'.freeze
3
+ VERSION = '2.6.1'.freeze
4
4
  end
5
5
  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,VGhpcyBpcyB0ZXN0IHN0cmluZw=="
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 UnknownMimeTypeError for unknown mime types' do
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(Carrierwave::Base64::UnknownMimeTypeError)
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, 'invalid base64')
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.0
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-12 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: carrierwave