mhtml 0.1.4 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d46e644c02af32f1834074122606f376c40dad7d
4
- data.tar.gz: '0188874fe3d843815efa889b5d2cb1c4c5ebcdbf'
3
+ metadata.gz: 3f4bc1a6b568ad1e1febef6b4478dcb1404c6244
4
+ data.tar.gz: 782098fd53cf5aba2cb30365778be234612cb395
5
5
  SHA512:
6
- metadata.gz: 3d3fe74d71b05c0b35699f94a11e9c393958a002e81421b16d0743d76d3776401ecc358e40f3c57ca657f65a36f9132a58ab4cc2a9472812abd00b1bfe4b7682
7
- data.tar.gz: 2e102e1eb2f75bdeeea94fe3b4b81128c09ec552be44e19f88de14a28d21bf0a5a0905b7bcbffa5a719b24988c90792331fc0a1518d37c8fdb75820942162c6e
6
+ metadata.gz: e7cab2a94057c38dd8cbfa0a0a83f43127d3f4266b3f91a2495b3335358a50f3f0414bf819dddb2b2f0cd901d1e420a4d99ff25daa216fafc6cbcf018e606a52
7
+ data.tar.gz: 46bce7e133c9ca26bae36fe4f26f1c7819931a85b1d9567d782742419be72d4c62416da0a86545c8f74848e5fad4dd1929fd44084350133461814ff92ac68747
@@ -7,6 +7,7 @@ module Mhtml
7
7
  attr_accessor :headers,
8
8
  :body,
9
9
  :is_quoted_printable,
10
+ :is_base_64,
10
11
  :encoding,
11
12
  :file_path,
12
13
  :root_doc
@@ -16,6 +17,7 @@ module Mhtml
16
17
  @header_key = nil
17
18
  @header_value_lines = nil
18
19
  @is_quoted_printable = false
20
+ @is_base_64 = false
19
21
  @encoding = nil
20
22
 
21
23
  @request = HttpParser::Parser.new_instance { |inst| inst.type = :response }
@@ -143,8 +145,12 @@ module Mhtml
143
145
  elsif header.key == 'Content-Transfer-Encoding'
144
146
  value = header.values.first
145
147
 
146
- if !value.nil? && value.value == 'quoted-printable'
147
- @is_quoted_printable = true
148
+ if !value.nil?
149
+ if value.value == 'quoted-printable'
150
+ @is_quoted_printable = true
151
+ elsif value.value == 'base64'
152
+ @is_base_64 = true
153
+ end
148
154
  end
149
155
 
150
156
  elsif header.key == 'Content-Location'
@@ -161,6 +167,7 @@ module Mhtml
161
167
 
162
168
  def decode(str)
163
169
  str = str.unpack1('M*') if @is_quoted_printable
170
+ str = Base64.decode64(str) if @is_base_64
164
171
  str = str.force_encoding(@encoding) unless @encoding.nil?
165
172
  str
166
173
  end
data/lib/mhtml/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Mhtml
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mhtml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Williams