Project

General

Profile

Defect #34046 ยป fixed-34046.patch

Yuichi HARADA, 2020-09-30 09:34

View differences:

lib/redmine/helpers/gantt.rb
400 400
            gc.stroke('transparent')
401 401
            gc.strokewidth(1)
402 402
            gc.draw('text %d,%d %s' % [
403
              left.round + 8, 14, Redmine::Utils::Shell.shell_quote("#{month_f.year}-#{month_f.month}")
403
              left.round + 8, 14, image_text_quote("#{month_f.year}-#{month_f.month}")
404 404
            ])
405 405
            left = left + width
406 406
            month_f = month_f >> 1
......
436 436
              gc.stroke('transparent')
437 437
              gc.strokewidth(1)
438 438
              gc.draw('text %d,%d %s' % [
439
                left.round + 2, header_height + 14, Redmine::Utils::Shell.shell_quote(week_f.cweek.to_s)
439
                left.round + 2, header_height + 14, image_text_quote(week_f.cweek.to_s)
440 440
              ])
441 441
              left = left + width
442 442
              week_f = week_f + 7
......
797 797
        params[:image].stroke('transparent')
798 798
        params[:image].strokewidth(1)
799 799
        params[:image].draw('text %d,%d %s' % [
800
          params[:indent], params[:top] + 2, Redmine::Utils::Shell.shell_quote(subject)
800
          params[:indent], params[:top] + 2, image_text_quote(subject)
801 801
        ])
802 802
      end
803 803

  
......
1040 1040
        if label
1041 1041
          params[:image].fill('black')
1042 1042
          params[:image].draw('text %d,%d %s' % [
1043
            params[:subject_width] + (coords[:bar_end] || 0) + 5, params[:top] + 1, Redmine::Utils::Shell.shell_quote(label)
1043
            params[:subject_width] + (coords[:bar_end] || 0) + 5, params[:top] + 1, image_text_quote(label)
1044 1044
          ])
1045 1045
        end
1046 1046
      end
1047

  
1048
      def image_text_quote(text)
1049
        if Redmine::Platform.mswin?
1050
          %Q!"#{text.gsub(/(")/, '\\\\\1')}"!
1051
        else
1052
          %Q!'#{text.gsub(/(')/, '\\\\\1')}'!
1053
        end
1054
      end
1047 1055
    end
1048 1056
  end
1049 1057
end
test/functional/gantts_controller_test.rb
170 170

  
171 171
  if Object.const_defined?(:MiniMagick) && convert_installed?
172 172
    def test_gantt_should_export_to_png
173
      Issue.generate!(:subject => %q!Subject containing special characters " and '!)
173 174
      get(
174 175
        :show,
175 176
        :params => {
    (1-1/1)