Skip to content

Commit bb7d87c

Browse files
committed
Removed VaultListMigratorHelpers
1 parent 72c63cf commit bb7d87c

7 files changed

Lines changed: 15 additions & 176 deletions

File tree

src/Core/SecureFolderFS.Core.Cryptography/ContentCrypt/BaseContentCrypt.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public virtual long CalculateCiphertextSize(long plaintextSize)
3535
/// <inheritdoc/>
3636
public virtual long CalculatePlaintextSize(long ciphertextSize)
3737
{
38-
if (ciphertextSize == 0L)
38+
if (ciphertextSize <= 0L)
3939
return 0L;
4040

4141
var chunkOverhead = ChunkCiphertextSize - ChunkPlaintextSize;

src/Core/SecureFolderFS.Core.FileSystem/Helpers/Paths/Abstract/AbstractPathHelpers.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ public static byte[] AllocateDirectoryId(Security security, string? path = null)
2323

2424
public static ReadOnlySpan<char> RemoveCiphertextExtension(string ciphertextName)
2525
{
26-
// Do NOT use Path.GetFileNameWithoutExtension - after APFS or ContentProvider NFD-decomposes Base4K
26+
// Do NOT use Path.GetFileNameWithoutExtension - after APFS NFD-decomposes Base4K
2727
// codepoints, the string may contain spurious dot-like characters that confuse the
2828
// path parser, causing it to truncate mid-ciphertext.
2929
// Strip the known extension manually instead.
3030
var nameWithoutExtension = ciphertextName.EndsWith(Constants.Names.ENCRYPTED_FILE_EXTENSION, StringComparison.Ordinal)
3131
? ciphertextName.AsSpan(0, ciphertextName.Length - Constants.Names.ENCRYPTED_FILE_EXTENSION.Length)
3232
: ciphertextName.AsSpan();
3333

34-
// Only normalize if needed. APFS/Android layers NFD-decompose Base4K codepoints,
34+
// Only normalize if needed. APFS layers NFD-decompose Base4K codepoints,
3535
// but Dokany/WinFsp deliver names in a form where NFC recomposition breaks lookup.
36-
if (OperatingSystem.IsAndroid() || OperatingSystem.IsIOS() || OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst())
36+
if (OperatingSystem.IsIOS() || OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst())
3737
{
3838
// IsNormalized() lets the string itself determine whether normalization is safe.
3939
// TODO: Fix normalization in Vault V4

src/Core/SecureFolderFS.Core.FileSystem/Storage/CryptoFile.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.IO;
1+
using System.IO;
32
using System.Threading;
43
using System.Threading.Tasks;
54
using OwlCore.Storage;

src/Platforms/SecureFolderFS.Uno/Helpers/MimeHelpers.cs

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/Platforms/SecureFolderFS.Uno/Helpers/VaultListMigratorHelpers.cs

Lines changed: 0 additions & 109 deletions
This file was deleted.

src/Platforms/SecureFolderFS.Uno/UserControls/InterfaceRoot/MainWindowRootControl.xaml.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,6 @@ private async Task EnsureRootAsync()
7373
if (ViewModel is null)
7474
return;
7575

76-
if (!VaultListMigratorHelpers.IsMigrated())
77-
{
78-
var file = await VaultListMigratorHelpers.TryGetVaultsFileAsync(CancellationToken.None);
79-
if (file is not null)
80-
{
81-
await VaultListMigratorHelpers.TryMigrateVaultsAsync(file, StreamSerializer.Instance, CancellationToken.None);
82-
VaultListMigratorHelpers.SetMigrated();
83-
}
84-
}
85-
8676
// Initialize the root view model
8777
await ViewModel.InitAsync();
8878

src/Sdk/SecureFolderFS.Sdk/ViewModels/Controls/Storage/Browser/FileViewModel.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,19 @@ protected override async Task OpenAsync(CancellationToken cancellationToken)
155155
if (!result.Positive())
156156
return;
157157

158-
if (BrowserViewModel.TransferViewModel is not { } transferViewModel)
158+
if (BrowserViewModel.TransferViewModel is { } transferViewModel)
159159
{
160-
await persistable.SaveAsync(cancellationToken);
161-
return;
160+
transferViewModel.TransferType = TransferType.Save;
161+
using var saveCancellation = transferViewModel.GetCancellation();
162+
await transferViewModel.PerformOperationAsync(async ct =>
163+
{
164+
await persistable.SaveAsync(ct);
165+
}, saveCancellation.Token);
162166
}
167+
else
168+
await persistable.SaveAsync(cancellationToken);
163169

164-
transferViewModel.TransferType = TransferType.Save;
165-
using var saveCancellation = transferViewModel.GetCancellation();
166-
await transferViewModel.PerformOperationAsync(async ct =>
167-
{
168-
await persistable.SaveAsync(ct);
169-
}, saveCancellation.Token);
170+
await PerformFileLoadAsync(cancellationToken);
170171
}
171172
}
172173
}

0 commit comments

Comments
 (0)