check sha1 hash value only if present

This commit is contained in:
Brian Gough 2017-02-15 14:12:36 +00:00
parent bd70aaa76c
commit b5a4458b68

View file

@ -67,7 +67,9 @@ module.exports = RedisManager =
multi.exec (error, [docLines, version, storedHash, doc_project_id, ranges])->
timer.done()
return callback(error) if error?
if docLines?
# check sha1 hash value if present
if docLines? and storedHash?
computedHash = RedisManager._computeHash(docLines)
if computedHash isnt storedHash
logger.error project_id: project_id, doc_id: doc_id, doc_project_id: doc_project_id, computedHash: computedHash, storedHash: storedHash, "hash mismatch on retrieved document"