Skip to content

Commit

Permalink
Compare hashes for date skip (#1279)
Browse files Browse the repository at this point in the history
* This sort of usage is a reason this was implemented

Post #1067 and loosely related to #819

Auto-merge
  • Loading branch information
Martii authored Nov 22, 2017
1 parent 3789a51 commit e6d4876
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion controllers/scriptStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,12 @@ exports.storeScript = function (aUser, aMeta, aBuf, aUpdate, aCallback) {
// Okay to update
aScript.hash = crypto.createHash('sha512').update(aBuf).digest('hex');

aScript.updated = new Date();
// Check hash here against old and don't increment Script model date if same.
// Allows sync reset for GH and resave/reset to S3 if needed
// Covers issue with GitHub cache serving old raw
if (script.hash !== aScript.hash) {
aScript.updated = new Date();
}

if (findMeta(script.meta, 'UserScript.version.0.value') !==
findMeta(aMeta, 'UserScript.version.0.value')) {
Expand Down

0 comments on commit e6d4876

Please sign in to comment.