Update src/backend/utils/database-file-encryption.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -146,14 +146,7 @@ class DatabaseFileEncryption {
|
|||||||
fs.writeFileSync(tmpPath, encrypted);
|
fs.writeFileSync(tmpPath, encrypted);
|
||||||
fs.writeFileSync(tmpMetadataPath, JSON.stringify(metadata, null, 2));
|
fs.writeFileSync(tmpMetadataPath, JSON.stringify(metadata, null, 2));
|
||||||
|
|
||||||
if (fs.existsSync(encryptedPath)) {
|
|
||||||
fs.unlinkSync(encryptedPath);
|
|
||||||
}
|
|
||||||
fs.renameSync(tmpPath, encryptedPath);
|
fs.renameSync(tmpPath, encryptedPath);
|
||||||
|
|
||||||
if (fs.existsSync(metadataPath)) {
|
|
||||||
fs.unlinkSync(metadataPath);
|
|
||||||
}
|
|
||||||
fs.renameSync(tmpMetadataPath, metadataPath);
|
fs.renameSync(tmpMetadataPath, metadataPath);
|
||||||
|
|
||||||
databaseLogger.info("Database file encrypted successfully", {
|
databaseLogger.info("Database file encrypted successfully", {
|
||||||
|
|||||||
Reference in New Issue
Block a user