Skip to content

Commit bc9341e

Browse files
committed
Apply code review
1 parent e2dead6 commit bc9341e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/Core/SecureFolderFS.Core.FileSystem/Helpers/RecycleBin/Abstract/AbstractRecycleBinHelpers.Operational.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public static async Task DeleteOrRecycleAsync(
135135
var directoryId = AbstractPathHelpers.AllocateDirectoryId(specifics.Security, ciphertextSourceFolder.Id);
136136

137137
// Decrypt the plaintext name
138-
var plaintextName = await AbstractPathHelpers.DecryptNameAsync(ciphertextItem.Name, ciphertextSourceFolder, specifics, cancellationToken) ?? string.Empty;
138+
var plaintextName = await AbstractPathHelpers.DecryptNameAsync(ciphertextItem.Name, ciphertextSourceFolder, specifics, directoryId, cancellationToken);
139139
if (plaintextName is null)
140140
throw new FormatException("Could not decrypt name for recycle bin configuration file.");
141141

@@ -195,7 +195,7 @@ public static async Task DeleteOrRecycleAsync(
195195
throw new FormatException("Could not decrypt parent path for the recycle bin configuration file.");
196196

197197
// Determine if Directory ID is present
198-
var isDirectoryIdPresent = directoryId.IsEmpty() || directoryId.IsAllZeros();
198+
var isDirectoryIdPresent = !directoryId.IsEmpty() && !directoryId.IsAllZeros();
199199

200200
// Encrypt the new plaintext name and parent ID
201201
var newCiphertextName = RecycleBinItemDataModel.Encrypt(plaintextName, specifics.Security, isDirectoryIdPresent ? directoryId : ReadOnlySpan<byte>.Empty);

src/Core/SecureFolderFS.Core.FileSystem/Helpers/RecycleBin/Native/NativeRecycleBinHelpers.Operational.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public static void DeleteOrRecycle(string ciphertextPath, FileSystemSpecifics sp
8484
throw new FormatException("Could not decrypt parent path for recycle bin configuration file.");
8585

8686
// Determine if Directory ID is present
87-
var isDirectoryIdPresent = directoryId.IsEmpty() || directoryId.IsAllZeros();
87+
var isDirectoryIdPresent = !directoryId.IsEmpty() && !directoryId.IsAllZeros();
8888

8989
// Encrypt the new plaintext name and parent ID
9090
var newCiphertextName = RecycleBinItemDataModel.Encrypt(plaintextName, specifics.Security, isDirectoryIdPresent ? directoryId : ReadOnlySpan<byte>.Empty);

0 commit comments

Comments
 (0)