core.patch

v2 - Pavel Rosick√Ĺ, 2019-03-19 23:45

Download (6.51 KB)

View differences:

app/models/mail_handler.rb (working copy)
43 43
    options[:no_notification] = (options[:no_notification].to_s == '1')
44 44
    options[:no_permission_check] = (options[:no_permission_check].to_s == '1')
45 45

  
46
    raw_mail.force_encoding('ASCII-8BIT')
47

  
48 46
    ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload|
49
      mail = Mail.new(raw_mail)
47
      mail = Mail.new(raw_mail.b)
50 48
      set_payload_for_mail(payload, mail)
51 49
      new.receive(mail, options)
52 50
    end
lib/redmine/codeset_util.rb (working copy)
16 16

  
17 17
    def self.to_utf8(str, encoding)
18 18
      return if str.nil?
19
      str = str.dup
20
      str.force_encoding("ASCII-8BIT")
19
      str = str.b
21 20
      if str.empty?
22 21
        str.force_encoding("UTF-8")
23 22
        return str
......
41 40

  
42 41
    def self.to_utf8_by_setting_internal(str)
43 42
      return if str.nil?
44
      str = str.dup
45
      str.force_encoding('ASCII-8BIT')
43
      str = str.b
46 44
      return str if str.empty?
47 45
      return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
48 46
      str.force_encoding('UTF-8')
lib/redmine/export/pdf.rb (working copy)
134 134
      class RDMPdfEncoding
135 135
        def self.rdm_from_utf8(txt, encoding)
136 136
          txt ||= ''
137
          txt = Redmine::CodesetUtil.from_utf8(txt, encoding)
138
          txt.force_encoding('ASCII-8BIT')
139
          txt
137
          Redmine::CodesetUtil.from_utf8(txt, encoding).b
140 138
        end
141 139

  
142 140
        def self.attach(attachments, filename, encoding)
lib/redmine/scm/adapters/bazaar_adapter.rb (working copy)
45 45
          end
46 46

  
47 47
          def scm_command_version
48
            scm_version = scm_version_from_command_line.dup.force_encoding('ASCII-8BIT')
48
            scm_version = scm_version_from_command_line.b
49 49
            if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
50 50
              m[2].scan(%r{\d+}).collect(&:to_i)
51 51
            end
......
98 98
          scm_cmd(*cmd_args) do |io|
99 99
            prefix_utf8 = "#{url}/#{path}".tr('\\', '/')
100 100
            logger.debug "PREFIX: #{prefix_utf8}"
101
            prefix = scm_iconv(@path_encoding, 'UTF-8', prefix_utf8)
102
            prefix.force_encoding('ASCII-8BIT')
101
            prefix = scm_iconv(@path_encoding, 'UTF-8', prefix_utf8).b
103 102
            re = %r{^V\s+(#{Regexp.escape(prefix)})?(\/?)([^\/]+)(\/?)\s+(\S+)\r?$}
104 103
            io.each_line do |line|
105 104
              next unless line =~ re
lib/redmine/scm/adapters/cvs_adapter.rb (working copy)
45 45
          end
46 46

  
47 47
          def scm_command_version
48
            scm_version = scm_version_from_command_line.dup.force_encoding('ASCII-8BIT')
48
            scm_version = scm_version_from_command_line.b
49 49
            if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)}m)
50 50
              m[2].scan(%r{\d+}).collect(&:to_i)
51 51
            end
......
93 93
        def entries(path=nil, identifier=nil, options={})
94 94
          logger.debug "<cvs> entries '#{path}' with identifier '#{identifier}'"
95 95
          path_locale = scm_iconv(@path_encoding, 'UTF-8', path)
96
          path_locale = path_locale.dup.force_encoding("ASCII-8BIT")
96
          path_locale = path_locale.b
97 97
          entries = Entries.new
98 98
          cmd_args = %w|-q rls -e|
99 99
          cmd_args << "-D" << time_to_cvstime_rlog(identifier) if identifier
lib/redmine/scm/adapters/git_adapter.rb (working copy)
49 49
          end
50 50

  
51 51
          def scm_command_version
52
            scm_version = scm_version_from_command_line.dup.force_encoding('ASCII-8BIT')
52
            scm_version = scm_version_from_command_line.b
53 53
            if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
54 54
              m[2].scan(%r{\d+}).collect(&:to_i)
55 55
            end
lib/redmine/scm/adapters/mercurial_adapter.rb (working copy)
58 58
            # The hg version is expressed either as a
59 59
            # release number (eg 0.9.5 or 1.0) or as a revision
60 60
            # id composed of 12 hexa characters.
61
            theversion = hgversion_from_command_line.dup.force_encoding('ASCII-8BIT')
61
            theversion = hgversion_from_command_line.b
62 62
            if m = theversion.match(%r{\A(.*?)((\d+\.)+\d+)})
63 63
              m[2].scan(%r{\d+}).collect(&:to_i)
64 64
            end
......
270 270
          blame = Annotate.new
271 271
          hg 'rhannotate', '-ncu', "-r#{CGI.escape(hgrev(identifier))}", '--', hgtarget(p) do |io|
272 272
            io.each_line do |line|
273
              line.force_encoding('ASCII-8BIT')
274
              next unless line =~ %r{^([^:]+)\s(\d+)\s([0-9a-f]+):\s(.*)$}
273
              next unless line.b =~ %r{^([^:]+)\s(\d+)\s([0-9a-f]+):\s(.*)$}
275 274
              r = Revision.new(:author => $1.strip, :revision => $2, :scmid => $3,
276 275
                               :identifier => $3)
277 276
              blame.add_line($4.rstrip, r)
lib/redmine/scm/adapters/subversion_adapter.rb (working copy)
48 48
          end
49 49

  
50 50
          def svn_binary_version
51
            scm_version = scm_version_from_command_line.dup.force_encoding('ASCII-8BIT')
51
            scm_version = scm_version_from_command_line.b
52 52
            if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
53 53
              m[2].scan(%r{\d+}).collect(&:to_i)
54 54
            end