Skip to content

Commit

Permalink
Use originalChecksum in sysmeta instead of newly calculated checksum,…
Browse files Browse the repository at this point in the history
… if it's not available
  • Loading branch information
laurenwalker committed Oct 23, 2019
1 parent 2c3aac0 commit ee84043
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/js/models/DataONEObject.js
Expand Up @@ -636,7 +636,7 @@ define(['jquery', 'underscore', 'backbone', 'uuid', 'he', 'collections/AccessPol
//Add the identifier to the XHR data
formData.append("pid", this.get("id"));

var sysMetaXML = this.serializeSysMeta({systemMetadataOnly: true});
var sysMetaXML = this.serializeSysMeta();

//Send the system metadata as a Blob
var xmlBlob = new Blob([sysMetaXML], {type: 'application/xml'});
Expand Down Expand Up @@ -753,7 +753,7 @@ define(['jquery', 'underscore', 'backbone', 'uuid', 'he', 'collections/AccessPol

},

serializeSysMeta: function(options){
serializeSysMeta: function(){
//Get the system metadata XML that currently exists in the system
var sysMetaXML = this.get("sysMetaXML"), // sysmeta as string
xml, // sysmeta as DOM object
Expand Down Expand Up @@ -811,13 +811,13 @@ define(['jquery', 'underscore', 'backbone', 'uuid', 'he', 'collections/AccessPol
}

//Update the checksum and checksum algorithm
if( options.systemMetadataOnly ){
if( !this.get("checksum") && this.get("originalChecksum") ){
xml.find("checksum").text(this.get("originalChecksum"));
}
else{
xml.find("checksum").text(this.get("checksum"));
}

xml.find("checksum").attr("algorithm", this.get("checksumAlgorithm"));

//Update the rightsholder
Expand Down

0 comments on commit ee84043

Please sign in to comment.