Commit c71a76e7 authored by Saito's avatar Saito

fix graph problem if authorname or message isnot utf8 encoding

parent efd9a717
...@@ -14,8 +14,23 @@ Grit::Blob.class_eval do ...@@ -14,8 +14,23 @@ Grit::Blob.class_eval do
end end
Grit::Commit.class_eval do Grit::Commit.class_eval do
def message def to_hash
Gitlab::Encode.utf8 @message {
'id' => id,
'parents' => parents.map { |p| { 'id' => p.id } },
'tree' => tree.id,
'message' => Gitlab::Encode.utf8(message),
'author' => {
'name' => Gitlab::Encode.utf8(author.name),
'email' => author.email
},
'committer' => {
'name' => Gitlab::Encode.utf8(committer.name),
'email' => committer.email
},
'authored_date' => authored_date.xmlschema,
'committed_date' => committed_date.xmlschema,
}
end end
end end
......
...@@ -96,13 +96,13 @@ class GraphCommit ...@@ -96,13 +96,13 @@ class GraphCommit
h[:parents] = self.parents.collect do |p| h[:parents] = self.parents.collect do |p|
[p.id,0,0] [p.id,0,0]
end end
h[:author] = author.name.force_encoding("UTF-8") h[:author] = author.name
h[:time] = time h[:time] = time
h[:space] = space h[:space] = space
h[:refs] = refs.collect{|r|r.name}.join(" ") unless refs.nil? h[:refs] = refs.collect{|r|r.name}.join(" ") unless refs.nil?
h[:id] = sha h[:id] = sha
h[:date] = date h[:date] = date
h[:message] = message.force_encoding("UTF-8") h[:message] = message
h[:login] = author.email h[:login] = author.email
h h
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment