Actions
Defect #34046
openEscaping symbols in task subject can broke export to Gantt (PNG)
Status:
Needs feedback
Priority:
Normal
Assignee:
-
Category:
Gantt
Target version:
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Affected version:
Description
Hello there, I think i found a problem with export Gantt to PNG. When I have task's subject with escape characters for example: "Student's Problems with new login page" I receive error (from Redmine logs):
MiniMagick::Error (`convert -size 1125x926 xc:white -stroke transparent -fill black -stroke transparent ... -strokewidth 1 -draw text 84,418 'Student'"'"'s Problems with new login page' -fill ... red -draw line 516,36 516,925 /tmp/mini_magick20200929-4913-1ne7j9r.png` failed with error: convert-im6.q16: non-conforming drawing primitive definition `'' @ error/draw.c/RenderMVGContent/4301. ): lib/redmine/helpers/gantt.rb:381:in `to_image' app/controllers/gantts_controller.rb:44:in `block (2 levels) in show' app/controllers/gantts_controller.rb:42:in `show' lib/redmine/sudo_mode.rb:65:in `sudo_mode'
And when I except this task by filters from Gantt everything is fine. Is there any chances to fix this issue?
Files
Related issues
Updated by Yuichi HARADA about 4 years ago
- File fixed-34046.patch fixed-34046.patch added
It used Redmine::Utils::Shell.shell_quote
to escape the subject string, but it was an escaping for the string that cannot be handled by the magick-convert command.
I fixed the special character escaping process as follows.
diff --git a/lib/redmine/helpers/gantt.rb b/lib/redmine/helpers/gantt.rb
index 31956bfae..168ce43f7 100644
--- a/lib/redmine/helpers/gantt.rb
+++ b/lib/redmine/helpers/gantt.rb
@@ -400,7 +400,7 @@ module Redmine
gc.stroke('transparent')
gc.strokewidth(1)
gc.draw('text %d,%d %s' % [
- left.round + 8, 14, Redmine::Utils::Shell.shell_quote("#{month_f.year}-#{month_f.month}")
+ left.round + 8, 14, image_text_quote("#{month_f.year}-#{month_f.month}")
])
left = left + width
month_f = month_f >> 1
@@ -436,7 +436,7 @@ module Redmine
gc.stroke('transparent')
gc.strokewidth(1)
gc.draw('text %d,%d %s' % [
- left.round + 2, header_height + 14, Redmine::Utils::Shell.shell_quote(week_f.cweek.to_s)
+ left.round + 2, header_height + 14, image_text_quote(week_f.cweek.to_s)
])
left = left + width
week_f = week_f + 7
@@ -797,7 +797,7 @@ module Redmine
params[:image].stroke('transparent')
params[:image].strokewidth(1)
params[:image].draw('text %d,%d %s' % [
- params[:indent], params[:top] + 2, Redmine::Utils::Shell.shell_quote(subject)
+ params[:indent], params[:top] + 2, image_text_quote(subject)
])
end
@@ -1040,10 +1040,18 @@ module Redmine
if label
params[:image].fill('black')
params[:image].draw('text %d,%d %s' % [
- params[:subject_width] + (coords[:bar_end] || 0) + 5, params[:top] + 1, Redmine::Utils::Shell.shell_quote(label)
+ params[:subject_width] + (coords[:bar_end] || 0) + 5, params[:top] + 1, image_text_quote(label)
])
end
end
+
+ def image_text_quote(text)
+ if Redmine::Platform.mswin?
+ %Q!"#{text.gsub(/(")/, '\\\\\1')}"!
+ else
+ %Q!'#{text.gsub(/(')/, '\\\\\1')}'!
+ end
+ end
end
end
end
Updated by Go MAEDA about 4 years ago
- Related to Feature #30492: Replace RMagick with MiniMagick added
Updated by Go MAEDA about 4 years ago
- Target version set to Candidate for next minor release
Updated by Mischa The Evil about 1 year ago
- Status changed from Confirmed to Needs feedback
This issue seems superseded and fixed by #38728. Can someone test and confirm this? Especially 'mswin' compatibility might be an issue...
Holger Just: care to chime in?
Updated by Mischa The Evil about 1 year ago
- Related to Defect #38728: Correctly escape issue text in Gantt PNG export for ImageMagick convert added
Updated by Kirill Trofimov about 1 year ago
Hello,
Unfortunately can't test it, as already this instance is out of my touch.
But anyway, thanks for supporting it.
Actions