Defect #21656

Fix Non ASCII attachment filename encoding broken (MOJIBAKE) in Microsoft Edge Explorer

Added by Hang Xie about 2 years ago. Updated almost 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Attachments
Target version:2.6.10
Resolution:Fixed Affected version:

Description

Microsoft Edge Explorer Change its User-Agent to this:

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586

It makes redmine can not detect correctly, and it is easy to fix:
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 98a2246..1fae635 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -595,7 +595,7 @@ class ApplicationController < ActionController::Base

   # Returns a string that can be used as filename value in Content-Disposition header
   def filename_for_content_disposition(name)
-    request.env['HTTP_USER_AGENT'] =~ %r{(MSIE|Trident)} ? ERB::Util.url_encode(name) : name
+    request.env['HTTP_USER_AGENT'] =~ %r{(MSIE|Trident|Edge)} ? ERB::Util.url_encode(name) : name
   end

   def api_request?


Related issues

Related to Redmine - Defect #16711: Non-ascii attachment file name get corrupted in IE11 Closed

Associated revisions

Revision 15013
Added by Jean-Philippe Lang about 2 years ago

Fix Non ASCII attachment filename encoding broken (MOJIBAKE) in Microsoft Edge Explorer (#21656).

Patch by by Hang Xie.

History

#1 Updated by Go MAEDA about 2 years ago

  • Related to Defect #16711: Non-ascii attachment file name get corrupted in IE11 added

#2 Updated by Go MAEDA about 2 years ago

  • Category set to Attachments
  • Target version set to 2.6.10

#3 Updated by Jean-Philippe Lang almost 2 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Also available in: Atom PDF