{"action":"created","comment":{"url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/comments/23192076","id":23192076,"diff_hunk":"@@ -0,0 +1,43 @@\n+module FedoraMigrate::DatastreamVerification\n+  \n+  attr_accessor :datastream\n+\n+  def valid? datastream=nil\n+    @datastream = datastream || source\n+    return true if no_checksum?\n+    return true if checksums_match?\n+    return true if content_equivalent? \n+    FedoraMigrate::Logger.warn \"#{source.pid} datastream #{datastream.dsid} validation failed\"\n+    return false\n+  end\n+\n+  def checksums_match?\n+    datastream.checksum == target_checksum.split(/:/).last\n+  end\n+\n+  # TODO: Reporting mechanism? If there isn't a checksum it defaults to \"none\" (issue #4)\n+  def no_checksum?\n+    if datastream.checksum == \"none\"\n+      FedoraMigrate::Logger.info \"unable to vaidate datastream because the checksum was 'none'\"\n+      return true\n+    end\n+  end\n+  \n+  def content_equivalent?\n+    if datastream.mimeType == \"text/xml\"\n+      EquivalentXml.equivalent?(target_content, datastream.content)","path":"lib/fedora_migrate/datastream_verification.rb","position":26,"original_position":28,"commit_id":"4df160f60b7917e1e8d6c303970f1167634ac0a7","original_commit_id":"88db06d42e8199e7f86b3147da201eae11c850fd","user":{"login":"mjgiarlo","id":131982,"avatar_url":"https://avatars.githubusercontent.com/u/131982?v=3","gravatar_id":"","url":"https://api.github.com/users/mjgiarlo","html_url":"https://github.com/mjgiarlo","followers_url":"https://api.github.com/users/mjgiarlo/followers","following_url":"https://api.github.com/users/mjgiarlo/following{/other_user}","gists_url":"https://api.github.com/users/mjgiarlo/gists{/gist_id}","starred_url":"https://api.github.com/users/mjgiarlo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mjgiarlo/subscriptions","organizations_url":"https://api.github.com/users/mjgiarlo/orgs","repos_url":"https://api.github.com/users/mjgiarlo/repos","events_url":"https://api.github.com/users/mjgiarlo/events{/privacy}","received_events_url":"https://api.github.com/users/mjgiarlo/received_events","type":"User","site_admin":false},"body":"I mean... there's a reason you put this in the code. Do we know why we're seeing mismatches? This feels like a workaround to me, but maybe I'm arguing from a place of ignorance! You've looked into this more than I have.","created_at":"2015-01-19T22:44:25Z","updated_at":"2015-01-19T22:44:25Z","html_url":"https://github.com/projecthydra-labs/fedora-migrate/pull/13#discussion_r23192076","pull_request_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/comments/23192076"},"html":{"href":"https://github.com/projecthydra-labs/fedora-migrate/pull/13#discussion_r23192076"},"pull_request":{"href":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/13","id":27635767,"html_url":"https://github.com/projecthydra-labs/fedora-migrate/pull/13","diff_url":"https://github.com/projecthydra-labs/fedora-migrate/pull/13.diff","patch_url":"https://github.com/projecthydra-labs/fedora-migrate/pull/13.patch","issue_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/issues/13","number":13,"state":"open","locked":false,"title":"DatastreamVerification","user":{"login":"awead","id":312085,"avatar_url":"https://avatars.githubusercontent.com/u/312085?v=3","gravatar_id":"","url":"https://api.github.com/users/awead","html_url":"https://github.com/awead","followers_url":"https://api.github.com/users/awead/followers","following_url":"https://api.github.com/users/awead/following{/other_user}","gists_url":"https://api.github.com/users/awead/gists{/gist_id}","starred_url":"https://api.github.com/users/awead/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/awead/subscriptions","organizations_url":"https://api.github.com/users/awead/orgs","repos_url":"https://api.github.com/users/awead/repos","events_url":"https://api.github.com/users/awead/events{/privacy}","received_events_url":"https://api.github.com/users/awead/received_events","type":"User","site_admin":false},"body":"Module that checks the validity of a datastream using its checksum or, if that fails, its xml content.","created_at":"2015-01-19T21:08:02Z","updated_at":"2015-01-19T22:44:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1e9746c1863a0b16b382d4c4064fd0d9bcef30a6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/13/commits","review_comments_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/13/comments","review_comment_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/comments/{number}","comments_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/issues/13/comments","statuses_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/statuses/4df160f60b7917e1e8d6c303970f1167634ac0a7","head":{"label":"projecthydra-labs:issue-11","ref":"issue-11","sha":"4df160f60b7917e1e8d6c303970f1167634ac0a7","user":{"login":"projecthydra-labs","id":7377013,"avatar_url":"https://avatars.githubusercontent.com/u/7377013?v=3","gravatar_id":"","url":"https://api.github.com/users/projecthydra-labs","html_url":"https://github.com/projecthydra-labs","followers_url":"https://api.github.com/users/projecthydra-labs/followers","following_url":"https://api.github.com/users/projecthydra-labs/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra-labs/subscriptions","organizations_url":"https://api.github.com/users/projecthydra-labs/orgs","repos_url":"https://api.github.com/users/projecthydra-labs/repos","events_url":"https://api.github.com/users/projecthydra-labs/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":25222874,"name":"fedora-migrate","full_name":"projecthydra-labs/fedora-migrate","owner":{"login":"projecthydra-labs","id":7377013,"avatar_url":"https://avatars.githubusercontent.com/u/7377013?v=3","gravatar_id":"","url":"https://api.github.com/users/projecthydra-labs","html_url":"https://github.com/projecthydra-labs","followers_url":"https://api.github.com/users/projecthydra-labs/followers","following_url":"https://api.github.com/users/projecthydra-labs/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra-labs/subscriptions","organizations_url":"https://api.github.com/users/projecthydra-labs/orgs","repos_url":"https://api.github.com/users/projecthydra-labs/repos","events_url":"https://api.github.com/users/projecthydra-labs/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projecthydra-labs/fedora-migrate","description":"Gem for migrating content to Fedora4","fork":false,"url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate","forks_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/forks","keys_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/teams","hooks_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/hooks","issue_events_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/issues/events{/number}","events_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/events","assignees_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/assignees{/user}","branches_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/branches{/branch}","tags_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/tags","blobs_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/git/refs{/sha}","trees_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/statuses/{sha}","languages_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/languages","stargazers_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/stargazers","contributors_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/contributors","subscribers_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/subscribers","subscription_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/subscription","commits_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/commits{/sha}","git_commits_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/git/commits{/sha}","comments_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/comments{/number}","issue_comment_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/issues/comments/{number}","contents_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/contents/{+path}","compare_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/merges","archive_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/downloads","issues_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/issues{/number}","pulls_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls{/number}","milestones_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/milestones{/number}","notifications_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/labels{/name}","releases_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/releases{/id}","created_at":"2014-10-14T19:27:20Z","updated_at":"2015-01-19T21:03:13Z","pushed_at":"2015-01-19T22:41:55Z","git_url":"git://github.com/projecthydra-labs/fedora-migrate.git","ssh_url":"git@github.com:projecthydra-labs/fedora-migrate.git","clone_url":"https://github.com/projecthydra-labs/fedora-migrate.git","svn_url":"https://github.com/projecthydra-labs/fedora-migrate","homepage":null,"size":1384,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":3,"default_branch":"master"}},"base":{"label":"projecthydra-labs:master","ref":"master","sha":"76809f5f25862b27957e900293dc31f6c99fb2e6","user":{"login":"projecthydra-labs","id":7377013,"avatar_url":"https://avatars.githubusercontent.com/u/7377013?v=3","gravatar_id":"","url":"https://api.github.com/users/projecthydra-labs","html_url":"https://github.com/projecthydra-labs","followers_url":"https://api.github.com/users/projecthydra-labs/followers","following_url":"https://api.github.com/users/projecthydra-labs/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra-labs/subscriptions","organizations_url":"https://api.github.com/users/projecthydra-labs/orgs","repos_url":"https://api.github.com/users/projecthydra-labs/repos","events_url":"https://api.github.com/users/projecthydra-labs/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra-labs/received_events","type":"Organization","site_admin":false},"repo":{"id":25222874,"name":"fedora-migrate","full_name":"projecthydra-labs/fedora-migrate","owner":{"login":"projecthydra-labs","id":7377013,"avatar_url":"https://avatars.githubusercontent.com/u/7377013?v=3","gravatar_id":"","url":"https://api.github.com/users/projecthydra-labs","html_url":"https://github.com/projecthydra-labs","followers_url":"https://api.github.com/users/projecthydra-labs/followers","following_url":"https://api.github.com/users/projecthydra-labs/following{/other_user}","gists_url":"https://api.github.com/users/projecthydra-labs/gists{/gist_id}","starred_url":"https://api.github.com/users/projecthydra-labs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projecthydra-labs/subscriptions","organizations_url":"https://api.github.com/users/projecthydra-labs/orgs","repos_url":"https://api.github.com/users/projecthydra-labs/repos","events_url":"https://api.github.com/users/projecthydra-labs/events{/privacy}","received_events_url":"https://api.github.com/users/projecthydra-labs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projecthydra-labs/fedora-migrate","description":"Gem for migrating content to Fedora4","fork":false,"url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate","forks_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/forks","keys_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/teams","hooks_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/hooks","issue_events_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/issues/events{/number}","events_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/events","assignees_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/assignees{/user}","branches_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/branches{/branch}","tags_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/tags","blobs_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/git/refs{/sha}","trees_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/statuses/{sha}","languages_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/languages","stargazers_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/stargazers","contributors_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/contributors","subscribers_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/subscribers","subscription_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/subscription","commits_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/commits{/sha}","git_commits_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/git/commits{/sha}","comments_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/comments{/number}","issue_comment_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/issues/comments/{number}","contents_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/contents/{+path}","compare_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/merges","archive_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/downloads","issues_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/issues{/number}","pulls_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls{/number}","milestones_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/milestones{/number}","notifications_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/labels{/name}","releases_url":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/releases{/id}","created_at":"2014-10-14T19:27:20Z","updated_at":"2015-01-19T21:03:13Z","pushed_at":"2015-01-19T22:41:55Z","git_url":"git://github.com/projecthydra-labs/fedora-migrate.git","ssh_url":"git@github.com:projecthydra-labs/fedora-migrate.git","clone_url":"https://github.com/projecthydra-labs/fedora-migrate.git","svn_url":"https://github.com/projecthydra-labs/fedora-migrate","homepage":null,"size":1384,"stargazers_count":3,"watchers_count":3,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/13"},"html":{"href":"https://github.com/projecthydra-labs/fedora-migrate/pull/13"},"issue":{"href":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/issues/13"},"comments":{"href":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/projecthydra-labs/fedora-migrate/statuses/4df160f60b7917e1e8d6c303970f1167634ac0a7"}}}}