Actions
Defect #20278
closedWrong syntax for resizing inline images will throw a 500 error
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Affected version:
Description
Given the following Textile code:
|_.Text| |!width:50%FE-Image.jpg!|
will throw a 500 error in Redmine with an attachment file called FE-Image.jpg after saving.
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
Using the correct syntax:
|_.Text|
|!{width:50%}FE-Image.jpg!|
will display the correct image downsized to 50%.
Is there a way to catch such user-generated error?
Related issues
Actions