griddler 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/griddler/email.rb +18 -5
- data/lib/griddler/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4163676a81c7d1daa49b40040fb2078c17bcc5f4
|
4
|
+
data.tar.gz: 4e2e62835388a98d6760e7f98b7f71a598e8fb51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c55df130df4369efbfdbde629bc9acb8a87297cc183a2344263afef909c06bf568bc6809279275beb7137c98f5851ccdac9e1ed444ce46860b6bca906c05cd0c
|
7
|
+
data.tar.gz: a49562fba84daabee4c201ed85eacaafb3016c202d2edd22f8dd4f722405c1132cb17e3068dbc205b753cb5b06291858f2d2295c7bf1d51591f699436894ebf3
|
data/lib/griddler/email.rb
CHANGED
@@ -41,7 +41,7 @@ module Griddler
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def extract_address(address)
|
44
|
-
EmailParser.parse_address(address)
|
44
|
+
EmailParser.parse_address(clean_text(address))
|
45
45
|
end
|
46
46
|
|
47
47
|
def extract_body
|
@@ -50,10 +50,7 @@ module Griddler
|
|
50
50
|
|
51
51
|
def extract_headers
|
52
52
|
if params[:headers].is_a?(Hash)
|
53
|
-
params[:headers]
|
54
|
-
header_hash[header_name] = clean_invalid_utf8_bytes(header_value)
|
55
|
-
header_hash
|
56
|
-
end
|
53
|
+
deep_clean_invalid_utf8_bytes(params[:headers])
|
57
54
|
else
|
58
55
|
EmailParser.extract_headers(clean_invalid_utf8_bytes(params[:headers]))
|
59
56
|
end
|
@@ -79,6 +76,22 @@ module Griddler
|
|
79
76
|
cleaned_html
|
80
77
|
end
|
81
78
|
|
79
|
+
def deep_clean_invalid_utf8_bytes(object)
|
80
|
+
case object
|
81
|
+
when Hash
|
82
|
+
object.inject({}) do |clean_hash, (key, dirty_value)|
|
83
|
+
clean_hash[key] = deep_clean_invalid_utf8_bytes(dirty_value)
|
84
|
+
clean_hash
|
85
|
+
end
|
86
|
+
when Array
|
87
|
+
object.map { |element| deep_clean_invalid_utf8_bytes(element) }
|
88
|
+
when String
|
89
|
+
clean_invalid_utf8_bytes(object)
|
90
|
+
else
|
91
|
+
object
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
82
95
|
def clean_invalid_utf8_bytes(text)
|
83
96
|
if text && !text.valid_encoding?
|
84
97
|
text.force_encoding('ISO-8859-1').encode('UTF-8')
|
data/lib/griddler/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: griddler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Caleb Thompson
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-
|
14
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.4.
|
144
|
+
rubygems_version: 2.4.8
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: SendGrid Parse API client Rails Engine
|