Index: app/models/repository/bazaar.rb =================================================================== --- app/models/repository/bazaar.rb (Revision 1382) +++ app/models/repository/bazaar.rb (Arbeitskopie) @@ -16,6 +16,7 @@ # 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 @@ -34,6 +35,11 @@ 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], @@ -68,7 +74,8 @@ :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, @@ -83,4 +90,11 @@ end end end + + private + + def fix_corrupt_encode(untrusted_string) + Iconv.new('UTF-8//IGNORE', 'UTF-8').iconv(untrusted_string + ' ')[0..-2] + end + end