mail 2.7.0 → 2.7.1.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/mail/body.rb +2 -2
- data/lib/mail/constants.rb +1 -1
- data/lib/mail/encodings/transfer_encoding.rb +1 -1
- data/lib/mail/field.rb +3 -1
- data/lib/mail/fields/content_type_field.rb +1 -1
- data/lib/mail/message.rb +3 -4
- data/lib/mail/part.rb +2 -2
- data/lib/mail/utilities.rb +32 -32
- data/lib/mail/version.rb +2 -2
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c7a286430676f89847640cf02f8b5a0e1e7c1e4151a629f0d26f8bb660bc48e5
|
4
|
+
data.tar.gz: 5d8aa0bcf4b95a7d01baea338edb3133c3ff47924e627b8d0a424e93a6d7fe7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a816d0c0cb167ece62be9a2749527668c70cd898d0c576d136ad6be89c1bfa3d93f109d1438d1f6e8b54caabfea58aee08aab3f6f5aaf32cbd7a6716b4b8db7d
|
7
|
+
data.tar.gz: 753249413f3a2bd8cf5a9666e1b1e39e3ffe7599b305302ab0e0ad4d323d6854e5c081cb154f2ac96c2b3fa1cb4ba1d413d81dfe49b290a5e059727ccab5f3f4
|
data/lib/mail/body.rb
CHANGED
@@ -39,9 +39,9 @@ module Mail
|
|
39
39
|
else
|
40
40
|
# Do join first incase we have been given an Array in Ruby 1.9
|
41
41
|
if string.respond_to?(:join)
|
42
|
-
@raw_source = string.join('')
|
42
|
+
@raw_source = ::Mail::Utilities.to_crlf(string.join(''))
|
43
43
|
elsif string.respond_to?(:to_s)
|
44
|
-
@raw_source = string.to_s
|
44
|
+
@raw_source = ::Mail::Utilities.to_crlf(string.to_s)
|
45
45
|
else
|
46
46
|
raise "You can only assign a string or an object that responds_to? :join or :to_s to a body."
|
47
47
|
end
|
data/lib/mail/constants.rb
CHANGED
@@ -33,7 +33,7 @@ module Mail
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.negotiate(message_encoding, source_encoding, str, allowed_encodings = nil)
|
36
|
-
message_encoding = Encodings.get_encoding(message_encoding || '8bit')
|
36
|
+
message_encoding = Encodings.get_encoding(message_encoding) || Encodings.get_encoding('8bit')
|
37
37
|
source_encoding = Encodings.get_encoding(source_encoding)
|
38
38
|
|
39
39
|
if message_encoding && source_encoding && message_encoding.can_transport?(source_encoding) && source_encoding.compatible_input?(str)
|
data/lib/mail/field.rb
CHANGED
@@ -147,6 +147,8 @@ module Mail
|
|
147
147
|
end
|
148
148
|
end
|
149
149
|
|
150
|
+
attr_reader :unparsed_value
|
151
|
+
|
150
152
|
# Create a field by name and optional value:
|
151
153
|
#
|
152
154
|
# Mail::Field.new("field-name", "value")
|
@@ -291,7 +293,7 @@ module Mail
|
|
291
293
|
# treated in its unfolded form for further syntactic and semantic
|
292
294
|
# evaluation.
|
293
295
|
def unfold(string)
|
294
|
-
string.gsub(/#{CRLF}(#{WSP})/m, '\1')
|
296
|
+
string.gsub(/#{Constants::CRLF}(#{Constants::WSP})/m, '\1')
|
295
297
|
end
|
296
298
|
end
|
297
299
|
end
|
@@ -175,7 +175,7 @@ module Mail
|
|
175
175
|
# and: audio/x-midi;\r\n\sname=Part .exe
|
176
176
|
params = $2.to_s.split(/\s+/)
|
177
177
|
params = params.map { |i| i.to_s.chomp.strip }
|
178
|
-
params = params.map { |i| i.split(/\s*\=\s
|
178
|
+
params = params.map { |i| i.split(/\s*\=\s*/, 2) }
|
179
179
|
params = params.map { |i| "#{i[0]}=#{dquote(i[1].to_s.gsub(/;$/,""))}" }.join('; ')
|
180
180
|
"#{type}; #{params}"
|
181
181
|
when val =~ /^\s*$/
|
data/lib/mail/message.rb
CHANGED
@@ -1984,7 +1984,7 @@ module Mail
|
|
1984
1984
|
|
1985
1985
|
private
|
1986
1986
|
|
1987
|
-
HEADER_SEPARATOR = /#{CRLF}#{CRLF}/
|
1987
|
+
HEADER_SEPARATOR = /#{Constants::CRLF}#{Constants::CRLF}/
|
1988
1988
|
|
1989
1989
|
# 2.1. General Description
|
1990
1990
|
# A message consists of header fields (collectively called "the header
|
@@ -2000,8 +2000,7 @@ module Mail
|
|
2000
2000
|
end
|
2001
2001
|
|
2002
2002
|
def raw_source=(value)
|
2003
|
-
|
2004
|
-
@raw_source = ::Mail::Utilities.to_crlf(value)
|
2003
|
+
@raw_source = value
|
2005
2004
|
end
|
2006
2005
|
|
2007
2006
|
# see comments to body=. We take data and process it lazily
|
@@ -2030,7 +2029,7 @@ module Mail
|
|
2030
2029
|
|
2031
2030
|
def set_envelope_header
|
2032
2031
|
raw_string = raw_source.to_s
|
2033
|
-
if match_data = raw_string.match(/\AFrom\s(#{TEXT}+)#{CRLF}/m)
|
2032
|
+
if match_data = raw_string.match(/\AFrom\s(#{TEXT}+)#{Constants::CRLF}/m)
|
2034
2033
|
set_envelope(match_data[1])
|
2035
2034
|
self.raw_source = raw_string.sub(match_data[0], "")
|
2036
2035
|
end
|
data/lib/mail/part.rb
CHANGED
@@ -104,8 +104,8 @@ module Mail
|
|
104
104
|
|
105
105
|
# A part may not have a header.... so, just init a body if no header
|
106
106
|
def parse_message
|
107
|
-
header_part, body_part = raw_source.split(/#{CRLF}#{WSP}*#{CRLF}/m, 2)
|
108
|
-
if header_part =~ HEADER_LINE
|
107
|
+
header_part, body_part = raw_source.split(/#{Constants::CRLF}#{Constants::WSP}*#{Constants::CRLF}/m, 2)
|
108
|
+
if header_part =~ Constants::HEADER_LINE
|
109
109
|
self.header = header_part
|
110
110
|
self.body = body_part
|
111
111
|
else
|
data/lib/mail/utilities.rb
CHANGED
@@ -24,9 +24,9 @@ module Mail
|
|
24
24
|
# If the string supplied has PHRASE unsafe characters in it, will return the string quoted
|
25
25
|
# in double quotes, otherwise returns the string unmodified
|
26
26
|
def quote_phrase( str )
|
27
|
-
if
|
27
|
+
if str.respond_to?(:force_encoding)
|
28
28
|
original_encoding = str.encoding
|
29
|
-
ascii_str = str.dup.force_encoding('ASCII-8BIT')
|
29
|
+
ascii_str = str.to_s.dup.force_encoding('ASCII-8BIT')
|
30
30
|
if (PHRASE_UNSAFE === ascii_str)
|
31
31
|
dquote(ascii_str).force_encoding(original_encoding)
|
32
32
|
else
|
@@ -45,7 +45,17 @@ module Mail
|
|
45
45
|
# If the string supplied has TOKEN unsafe characters in it, will return the string quoted
|
46
46
|
# in double quotes, otherwise returns the string unmodified
|
47
47
|
def quote_token( str )
|
48
|
-
|
48
|
+
if str.respond_to?(:force_encoding)
|
49
|
+
original_encoding = str.encoding
|
50
|
+
ascii_str = str.to_s.dup.force_encoding('ASCII-8BIT')
|
51
|
+
if token_safe?( ascii_str )
|
52
|
+
str
|
53
|
+
else
|
54
|
+
dquote(ascii_str).force_encoding(original_encoding)
|
55
|
+
end
|
56
|
+
else
|
57
|
+
token_safe?( str ) ? str : dquote(str)
|
58
|
+
end
|
49
59
|
end
|
50
60
|
|
51
61
|
# Wraps supplied string in double quotes and applies \-escaping as necessary,
|
@@ -241,45 +251,35 @@ module Mail
|
|
241
251
|
|
242
252
|
end
|
243
253
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
if ("\r".encode(:universal_newline => true) rescue nil) == LF &&
|
248
|
-
(LF.encode(:crlf_newline => true) rescue nil) == CRLF
|
249
|
-
# Using String#encode is better performing than Regexp
|
254
|
+
def self.binary_unsafe_to_lf(string) #:nodoc:
|
255
|
+
string.gsub(/\r\n|\r/, LF)
|
256
|
+
end
|
250
257
|
|
251
|
-
|
252
|
-
|
258
|
+
TO_CRLF_REGEX =
|
259
|
+
if RUBY_VERSION >= '1.9'
|
260
|
+
# This 1.9 only regex can save a reasonable amount of time (~20%)
|
261
|
+
# by not matching "\r\n" so the string is returned unchanged in
|
262
|
+
# the common case.
|
263
|
+
Regexp.new("(?<!\r)\n|\r(?!\n)")
|
264
|
+
else
|
265
|
+
/\n|\r\n|\r/
|
253
266
|
end
|
254
267
|
|
255
|
-
|
256
|
-
|
257
|
-
|
268
|
+
def self.binary_unsafe_to_crlf(string) #:nodoc:
|
269
|
+
string.gsub(TO_CRLF_REGEX, CRLF)
|
270
|
+
end
|
258
271
|
|
272
|
+
if RUBY_VERSION < '1.9'
|
259
273
|
def self.safe_for_line_ending_conversion?(string) #:nodoc:
|
260
274
|
string.ascii_only?
|
261
275
|
end
|
262
276
|
else
|
263
|
-
def self.
|
264
|
-
string.
|
265
|
-
|
266
|
-
|
267
|
-
TO_CRLF_REGEX =
|
268
|
-
if RUBY_VERSION >= '1.9'
|
269
|
-
# This 1.9 only regex can save a reasonable amount of time (~20%)
|
270
|
-
# by not matching "\r\n" so the string is returned unchanged in
|
271
|
-
# the common case.
|
272
|
-
Regexp.new("(?<!\r)\n|\r(?!\n)")
|
277
|
+
def self.safe_for_line_ending_conversion?(string) #:nodoc:
|
278
|
+
if string.encoding == Encoding::BINARY
|
279
|
+
string.ascii_only?
|
273
280
|
else
|
274
|
-
|
281
|
+
string.valid_encoding?
|
275
282
|
end
|
276
|
-
|
277
|
-
def self.binary_unsafe_to_crlf(string) #:nodoc:
|
278
|
-
string.gsub(TO_CRLF_REGEX, CRLF)
|
279
|
-
end
|
280
|
-
|
281
|
-
def self.safe_for_line_ending_conversion?(string) #:nodoc:
|
282
|
-
string.ascii_only?
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
data/lib/mail/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.7.
|
4
|
+
version: 2.7.1.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikel Lindsaar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mini_mime
|
@@ -241,12 +241,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
241
241
|
version: '0'
|
242
242
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
243
243
|
requirements:
|
244
|
-
- - "
|
244
|
+
- - ">"
|
245
245
|
- !ruby/object:Gem::Version
|
246
|
-
version:
|
246
|
+
version: 1.3.1
|
247
247
|
requirements: []
|
248
248
|
rubyforge_project:
|
249
|
-
rubygems_version: 2.
|
249
|
+
rubygems_version: 2.7.3
|
250
250
|
signing_key:
|
251
251
|
specification_version: 4
|
252
252
|
summary: Mail provides a nice Ruby DSL for making, sending and reading emails.
|