Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mi-yo/ee50689c508962d9229a to your computer and use it in GitHub Desktop.
Save mi-yo/ee50689c508962d9229a to your computer and use it in GitHub Desktop.
Inline image does not work with multibyte filename and plus sign. https://www.redmine.org/issues/10189
--- app/models/attachment.rb.org Sun Jul 6 21:44:07 2014
+++ app/models/attachment.rb Sun Nov 15 22:22:52 2015
@@ -255,7 +255,7 @@
def self.latest_attach(attachments, filename)
attachments.sort_by(&:created_on).reverse.detect {
- |att| att.filename.downcase == filename.downcase
+ |att| att.filename.downcase == CGI.unescape(filename.downcase.gsub(/\+/,'%2B'))
}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment