This is an automated email from the ASF dual-hosted git repository.
rubys pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new d56b208 URI encode/decode attachment part names
d56b208 is described below
commit d56b2085957eedd9f5c414e3578a54cdf90996a0
Author: Sam Ruby <[email protected]>
AuthorDate: Fri Oct 5 09:47:13 2018 -0400
URI encode/decode attachment part names
---
www/secretary/workbench/models/message.rb | 6 ++++--
www/secretary/workbench/views/parts.js.rb | 4 ++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/www/secretary/workbench/models/message.rb
b/www/secretary/workbench/models/message.rb
index 4fd5fe9..64d1f15 100644
--- a/www/secretary/workbench/models/message.rb
+++ b/www/secretary/workbench/models/message.rb
@@ -32,11 +32,13 @@ class Message
name = name.dup.force_encoding('utf-8')
headers = @headers[:attachments].find do |attach|
- attach[:name] == name or attach['Content-ID'].to_s == '<' + name + '>'
+ attach[:name] == name or URI.decode(attach[:name]) == name or
+ attach['Content-ID'].to_s == '<' + name + '>'
end
part = mail.attachments.find do |attach|
- attach.filename == name or attach['Content-ID'].to_s == '<' + name + '>'
+ attach.filename == name or URI.decode(attach.filename) == name or
+ attach['Content-ID'].to_s == '<' + name + '>'
end
if headers
diff --git a/www/secretary/workbench/views/parts.js.rb
b/www/secretary/workbench/views/parts.js.rb
index 696fc89..9a7fa88 100644
--- a/www/secretary/workbench/views/parts.js.rb
+++ b/www/secretary/workbench/views/parts.js.rb
@@ -50,9 +50,9 @@ class Parts < Vue
end
if attachment =~ /\.(pdf|txt|jpeg|jpg|gif|png)$/i
- link = "./#{attachment}"
+ link = "./#{encodeURIComponent(attachment)}"
else
- link = "_danger_/#{attachment}"
+ link = "_danger_/#{encodeURIComponent(attachment)}"
end
_li options do