Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix fopen mode
Signed-off-by: Côme Chilliet <[email protected]>
  • Loading branch information
come-nc committed May 4, 2023
commit 146284f170d3da88709ec76007f6f7b5ad975d39
11 changes: 8 additions & 3 deletions apps/encryption/lib/Command/FixLegacyFileKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,17 @@ private function scanFolder(OutputInterface $output, string $folder): bool {
/* If that did not throw and filekey is not empty, a legacy filekey is used */
$clean = false;
$output->writeln($path . ' is using a legacy filekey, migrating');
$file = $this->rootView->fopen($path, 'w+');
$file = $this->rootView->fopen($path, 'r+');
if ($file) {
fwrite($file, '');
$firstByte = fread($file, 1);
if ($firstByte === false) {
$output->writeln('<error>failed to read ' . $path . '</error>');
continue;
}
fwrite($file, $firstByte);
fclose($file);
} else {
$output->writeln('<error>failed to open' . $path . '</error>');
$output->writeln('<error>failed to open ' . $path . '</error>');
}
}
}
Expand Down