wix 0.0.4 → 0.0.5

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.
Files changed (3) hide show
  1. data/lib/wix/instance.rb +11 -3
  2. data/lib/wix/version.rb +1 -1
  3. metadata +3 -3
@@ -14,9 +14,10 @@ module Wix
14
14
  signature = split_wix_signed_instance[0]
15
15
  encoded_json = split_wix_signed_instance[1]
16
16
  raise WixError.new(INVALID_WIX_SIGNATURE) if !valid_signature(signature, encoded_json)
17
-
18
- json_string = Base64.decode64(encoded_json)
19
- hash = JSON.parse(json_string)
17
+
18
+ encoded_json += '=' * (4 - encoded_json.length.modulo(4)) if needs_base64_padding(encoded_json)
19
+ json_string = Base64.decode64(encoded_json)
20
+ hash = JSON.parse(json_string)
20
21
 
21
22
  RecursiveOpenStruct.new(hash, :recurse_over_arrays => true)
22
23
  rescue => error
@@ -29,5 +30,12 @@ module Wix
29
30
 
30
31
  signature == my_signature
31
32
  end
33
+
34
+ def self.needs_base64_padding(encoded_json)
35
+ Base64.strict_decode64(encoded_json)
36
+ false
37
+ rescue
38
+ true
39
+ end
32
40
  end
33
41
  end
@@ -1,3 +1,3 @@
1
1
  module Wix
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -142,7 +142,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  segments:
144
144
  - 0
145
- hash: -1883138079609829469
145
+ hash: 2847631539952728929
146
146
  required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  none: false
148
148
  requirements:
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  segments:
153
153
  - 0
154
- hash: -1883138079609829469
154
+ hash: 2847631539952728929
155
155
  requirements: []
156
156
  rubyforge_project:
157
157
  rubygems_version: 1.8.23