tmail 1.2.6 → 1.2.7

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.
@@ -41,7 +41,7 @@ module TMail
41
41
  end
42
42
 
43
43
  private
44
-
44
+ require 'ruby-debug'
45
45
  def attachment(part)
46
46
  if part.multipart?
47
47
  part.attachments
@@ -60,8 +60,17 @@ module TMail
60
60
 
61
61
  include TextUtils
62
62
 
63
+ def quoted?(string)
64
+ !!((string =~ /.+'\w\w'.+/) || (string =~ /=\?.+\?.\?.+\?=/))
65
+ end
66
+
67
+ # Only unquote if quoted
63
68
  def original_filename(to_charset = 'utf-8')
64
- Unquoter.unquote_and_convert_to(quoted_filename, to_charset).chomp
69
+ if quoted?(quoted_filename)
70
+ Unquoter.unquote_and_convert_to(quoted_filename, to_charset).chomp
71
+ else
72
+ quoted_filename
73
+ end
65
74
  end
66
75
  end
67
76
 
@@ -32,7 +32,7 @@ module TMail
32
32
  module VERSION
33
33
  MAJOR = 1
34
34
  MINOR = 2
35
- TINY = 6
35
+ TINY = 7
36
36
 
37
37
  STRING = [MAJOR, MINOR, TINY].join('.')
38
38
  end
@@ -44,7 +44,9 @@ HERE
44
44
  fixture = File.read(File.dirname(__FILE__) + "/fixtures/raw_email8")
45
45
  mail = TMail::Mail.parse(fixture)
46
46
  attachment = mail.attachments.last
47
- assert_equal "01 Quien Te Dij\302\212at. Pitbull.mp3", attachment.original_filename unless RUBY_VERSION.match(/1.9/)
47
+ expected = "01 Quien Te Dij\212at. Pitbull.mp3"
48
+ expected.force_encoding(Encoding::ASCII_8BIT) if expected.respond_to?(:force_encoding)
49
+ assert_equal expected, attachment.original_filename
48
50
  end
49
51
 
50
52
  def test_attachment_with_quoted_filename
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{tmail}
5
- s.version = "1.2.6"
5
+ s.version = "1.2.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Mikel Lindsaar <raasdnil AT gmail.com>"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tmail
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikel Lindsaar <raasdnil AT gmail.com>