bazaar.diff

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

Download (1.75 KB)

View differences:

app/models/repository/bazaar.rb (Arbeitskopie)
16 16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
17 17

  
18 18
require 'redmine/scm/adapters/bazaar_adapter'
19
require 'iconv'
19 20

  
20 21
class Repository::Bazaar < Repository
21 22
  attr_protected :root_url
......
34 35
    if entries
35 36
      entries.each do |e|
36 37
        next if e.lastrev.revision.blank?
38
        # Set the filesize unless browsing a specific revision
39
        if identifier.nil?
40
          full_path = File.join(root_url, e.path)
41
          e.size = File.stat(full_path).size if File.file?(full_path)
42
        end
37 43
        c = Change.find(:first,
38 44
                        :include => :changeset,
39 45
                        :conditions => ["#{Change.table_name}.revision = ? and #{Changeset.table_name}.repository_id = ?", e.lastrev.revision, id],
......
68 74
                                           :committer => revision.author, 
69 75
                                           :committed_on => revision.time,
70 76
                                           :scmid => revision.scmid,
71
                                           :comments => revision.message)
77
                                           :comments => revision.message,
78
					   :comments=>fix_corrupt_encode(revision.message))
72 79
              
73 80
              revision.paths.each do |change|
74 81
                Change.create(:changeset => changeset,
......
83 90
      end
84 91
    end
85 92
  end
93
  
94
  private
95
  
96
  def fix_corrupt_encode(untrusted_string)
97
    Iconv.new('UTF-8//IGNORE', 'UTF-8').iconv(untrusted_string + ' ')[0..-2]
98
  end
99
  
86 100
end