1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-22 04:31:13 +01:00

data in PhabricatorFile hashed using sha1

Summary: Hash file content using sha1

Test Plan: None provided

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4969
This commit is contained in:
kwadwo 2013-02-15 07:47:50 -08:00 committed by epriestley
parent 49c40d209d
commit d8d16ece5e

View file

@ -121,7 +121,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
$file = id(new PhabricatorFile())->loadOneWhere(
'name = %s AND contentHash = %s LIMIT 1',
self::normalizeFileName(idx($params, 'name')),
PhabricatorHash::digest($data));
self::hashFileContent($data));
if (!$file) {
$unguarded = AphrontWriteGuard::beginScopedUnguardedWrites();
@ -231,7 +231,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
$file->setName($file_name);
$file->setByteSize(strlen($data));
$file->setAuthorPHID($authorPHID);
$file->setContentHash(PhabricatorHash::digest($data));
$file->setContentHash(self::hashFileContent($data));
$file->setStorageEngine($engine_identifier);
$file->setStorageHandle($data_handle);
@ -373,7 +373,7 @@ final class PhabricatorFile extends PhabricatorFileDAO
}
public static function hashFileContent($data) {
return PhabricatorHash::digest($data);
return sha1($data);
}
public function loadFileData() {