Project

General

Profile

Defect #834 » bazaar.diff

Patch for app/models/repository/bazaar.rb - Andreas Deininger, 2008-05-27 17:19

View differences:

app/models/repository/bazaar.rb (Arbeitskopie)
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
require 'redmine/scm/adapters/bazaar_adapter'
require 'iconv'
class Repository::Bazaar < Repository
attr_protected :root_url
......
if entries
entries.each do |e|
next if e.lastrev.revision.blank?
# Set the filesize unless browsing a specific revision
if identifier.nil?
full_path = File.join(root_url, e.path)
e.size = File.stat(full_path).size if File.file?(full_path)
end
c = Change.find(:first,
:include => :changeset,
:conditions => ["#{Change.table_name}.revision = ? and #{Changeset.table_name}.repository_id = ?", e.lastrev.revision, id],
......
:committer => revision.author,
:committed_on => revision.time,
:scmid => revision.scmid,
:comments => revision.message)
:comments => revision.message,
:comments=>fix_corrupt_encode(revision.message))
revision.paths.each do |change|
Change.create(:changeset => changeset,
......
end
end
end
private
def fix_corrupt_encode(untrusted_string)
Iconv.new('UTF-8//IGNORE', 'UTF-8').iconv(untrusted_string + ' ')[0..-2]
end
end
(2-2/2)