Redmine: Issues
https://www.redmine.org/
https://www.redmine.org/favicon.ico?1679302129
2015-07-09T10:16:21Z
Redmine
Redmine
Redmine - Defect #20278 (Closed): Wrong syntax for resizing inline images will throw a 500 error
https://www.redmine.org/issues/20278
2015-07-09T10:16:21Z
Michael Skrynski
<p>Given the following Textile code:</p>
<pre>
|_.Text|
|!width:50%FE-Image.jpg!|
</pre>
<p>will throw a 500 error in Redmine with an attachment file called <code>FE-Image.jpg</code> after saving.</p>
<pre>
ActionView::Template::Error
invalid byte sequence in UTF-8
Stacktrace (most recent call first):
attachment.rb:259:in `downcase'
|att| att.filename.downcase == filename.downcase
attachment.rb:259:in `block in latest_attach'
|att| att.filename.downcase == filename.downcase
attachment.rb:258:in `each'
attachments.sort_by(&:created_on).reverse.detect {
attachment.rb:258:in `detect'
attachments.sort_by(&:created_on).reverse.detect {
attachment.rb:258:in `latest_attach'
attachments.sort_by(&:created_on).reverse.detect {
application_helper.rb:657:in `block in parse_inline_attachments'
if found = Attachment.latest_attach(attachments, CGI.unescape(filename))
application_helper.rb:654:in `gsub!'
text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m|
application_helper.rb:654:in `parse_inline_attachments'
text.gsub!(/src="([^\/"]+\.(bmp|gif|jpg|jpe|jpeg|png))"(\s+alt="([^"]*)")?/i) do |m|
application_helper.rb:605:in `block (2 levels) in textilizable'
send method_name, text, project, obj, attr, only_path, options
application_helper.rb:604:in `each'
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|
application_helper.rb:604:in `block in textilizable'
[:parse_inline_attachments, :parse_wiki_links, :parse_redmine_links].each do |method_name|
application_helper.rb:625:in `parse_non_pre_blocks'
yield text
</pre>
<p>Using the correct syntax:</p>
<pre>
|_.Text|
|!{width:50%}FE-Image.jpg!|
</pre>
<p>will display the correct image downsized to 50%.<br />Is there a way to catch such user-generated error?</p>