mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-10 00:42:41 +01:00
Fix file encoding migration
Summary: See [[ https://discourse.phabricator-community.org/t/file-encryption-corruption-when-trying-to-encode-existing-files/1605 | Discourse ]] When migrating to aes-256-cbc, integrity hashes were not updated, so data was not properly Test Plan: I ran [[ https://gist.github.com/kaendfinger/3e0d78350af0ebe4e74b2c8a79707bae | this test script ]] to ensure it worked. I created some files with lipsum, ensured that after encoding them with aes-256-cbc, they were not able to be cat'd. After applying this patch and rerunning the script, it worked successfully. Reviewers: epriestley, amckinley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: Korvin Tags: #files, #storage Differential Revision: https://secure.phabricator.com/D19533
This commit is contained in:
parent
6b6e1f0ba8
commit
6bdd74584e
1 changed files with 2 additions and 1 deletions
|
@ -492,12 +492,13 @@ final class PhabricatorFile extends PhabricatorFileDAO
|
|||
$this->setStorageFormat($format->getStorageFormatKey());
|
||||
$this->setStorageProperties($properties);
|
||||
|
||||
list($identifier, $new_handle) = $this->writeToEngine(
|
||||
list($identifier, $new_handle, $integrity_hash) = $this->writeToEngine(
|
||||
$engine,
|
||||
$data,
|
||||
$params);
|
||||
|
||||
$this->setStorageHandle($new_handle);
|
||||
$this->setIntegrityHash($integrity_hash);
|
||||
$this->save();
|
||||
|
||||
$this->deleteFileDataIfUnused(
|
||||
|
|
Loading…
Reference in a new issue