Project

General

Profile

Patch #31059 » core.patch

Pavel Rosický, 2019-03-19 18:39

View differences:

app/models/mail_handler.rb (working copy)
options[:no_notification] = (options[:no_notification].to_s == '1')
options[:no_permission_check] = (options[:no_permission_check].to_s == '1')
raw_mail.force_encoding('ASCII-8BIT')
ActiveSupport::Notifications.instrument("receive.action_mailer") do |payload|
mail = Mail.new(raw_mail)
mail = Mail.new(raw_mail.b)
set_payload_for_mail(payload, mail)
new.receive(mail, options)
end
lib/redmine/codeset_util.rb (working copy)
def self.to_utf8(str, encoding)
return if str.nil?
str = str.dup
str.force_encoding("ASCII-8BIT")
str = str.dup.b
if str.empty?
str.force_encoding("UTF-8")
return str
......
def self.to_utf8_by_setting_internal(str)
return if str.nil?
str = str.dup
str.force_encoding('ASCII-8BIT')
str = str.dup.b
return str if str.empty?
return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii
str.force_encoding('UTF-8')
lib/redmine/export/pdf.rb (working copy)
class RDMPdfEncoding
def self.rdm_from_utf8(txt, encoding)
txt ||= ''
txt = Redmine::CodesetUtil.from_utf8(txt, encoding)
txt.force_encoding('ASCII-8BIT')
txt
Redmine::CodesetUtil.from_utf8(txt, encoding).b
end
def self.attach(attachments, filename, encoding)
lib/redmine/scm/adapters/bazaar_adapter.rb (working copy)
end
def scm_command_version
scm_version = scm_version_from_command_line.dup.force_encoding('ASCII-8BIT')
scm_version = scm_version_from_command_line.dup.b
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end
......
scm_cmd(*cmd_args) do |io|
prefix_utf8 = "#{url}/#{path}".tr('\\', '/')
logger.debug "PREFIX: #{prefix_utf8}"
prefix = scm_iconv(@path_encoding, 'UTF-8', prefix_utf8)
prefix.force_encoding('ASCII-8BIT')
prefix = scm_iconv(@path_encoding, 'UTF-8', prefix_utf8).b
re = %r{^V\s+(#{Regexp.escape(prefix)})?(\/?)([^\/]+)(\/?)\s+(\S+)\r?$}
io.each_line do |line|
next unless line =~ re
lib/redmine/scm/adapters/cvs_adapter.rb (working copy)
end
def scm_command_version
scm_version = scm_version_from_command_line.dup.force_encoding('ASCII-8BIT')
scm_version = scm_version_from_command_line.dup.b
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)}m)
m[2].scan(%r{\d+}).collect(&:to_i)
end
......
def entries(path=nil, identifier=nil, options={})
logger.debug "<cvs> entries '#{path}' with identifier '#{identifier}'"
path_locale = scm_iconv(@path_encoding, 'UTF-8', path)
path_locale = path_locale.dup.force_encoding("ASCII-8BIT")
path_locale = path_locale.dup.b
entries = Entries.new
cmd_args = %w|-q rls -e|
cmd_args << "-D" << time_to_cvstime_rlog(identifier) if identifier
lib/redmine/scm/adapters/git_adapter.rb (working copy)
end
def scm_command_version
scm_version = scm_version_from_command_line.dup.force_encoding('ASCII-8BIT')
scm_version = scm_version_from_command_line.dup.b
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end
lib/redmine/scm/adapters/mercurial_adapter.rb (working copy)
# The hg version is expressed either as a
# release number (eg 0.9.5 or 1.0) or as a revision
# id composed of 12 hexa characters.
theversion = hgversion_from_command_line.dup.force_encoding('ASCII-8BIT')
theversion = hgversion_from_command_line.dup.b
if m = theversion.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end
......
blame = Annotate.new
hg 'rhannotate', '-ncu', "-r#{CGI.escape(hgrev(identifier))}", '--', hgtarget(p) do |io|
io.each_line do |line|
line.force_encoding('ASCII-8BIT')
next unless line =~ %r{^([^:]+)\s(\d+)\s([0-9a-f]+):\s(.*)$}
next unless line.b =~ %r{^([^:]+)\s(\d+)\s([0-9a-f]+):\s(.*)$}
r = Revision.new(:author => $1.strip, :revision => $2, :scmid => $3,
:identifier => $3)
blame.add_line($4.rstrip, r)
lib/redmine/scm/adapters/subversion_adapter.rb (working copy)
end
def svn_binary_version
scm_version = scm_version_from_command_line.dup.force_encoding('ASCII-8BIT')
scm_version = scm_version_from_command_line.dup.b
if m = scm_version.match(%r{\A(.*?)((\d+\.)+\d+)})
m[2].scan(%r{\d+}).collect(&:to_i)
end
(1-1/4)