Skip to content

Commit

Permalink
wrapping embedded data with xml comments
Browse files Browse the repository at this point in the history
rescuing corrupt embedded data

closes huboard#61 and closes huboard#60
  • Loading branch information
rauhryan committed Jun 14, 2012
1 parent f61504e commit 31a46a5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions stint/stint/lib/stint/pebble.rb
Expand Up @@ -69,7 +69,7 @@ def reorder_issue(user_name, repo, number, index)
issue = github.issue_by_id user_name, repo, number
_data = embedded_data issue["body"]
if _data.empty?
post_data["body"] = issue["body"].concat "\r\n@huboard:#{JSON.dump({:order => index.to_f})}"
post_data["body"] = issue["body"].concat "\r\n<!--\r\n@huboard:#{JSON.dump({:order => index.to_f})}\r\n-->\r\n"
else
post_data["body"] = issue["body"].gsub /@huboard:.*/, "@huboard:#{JSON.dump(_data.merge({"order" => index.to_f}))}"
end
Expand Down Expand Up @@ -201,7 +201,11 @@ def embedded_data(body)
match = r.match body
return { } if match.nil?

JSON.load(match[1])
begin
JSON.load(match[1])
rescue
return {}
end
end

def close_card(user_name, repo, the_issue)
Expand Down

0 comments on commit 31a46a5

Please sign in to comment.