Skip to content

Commit 41c37fa

Browse files
committed
Use IsNormalized
1 parent 2303f80 commit 41c37fa

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ public static ReadOnlySpan<char> RemoveCiphertextExtension(string ciphertextName
3131
? ciphertextName.AsSpan(0, ciphertextName.Length - Constants.Names.ENCRYPTED_FILE_EXTENSION.Length)
3232
: ciphertextName.AsSpan();
3333

34-
if (OperatingSystem.IsAndroid() || OperatingSystem.IsIOS() || OperatingSystem.IsMacOS() || OperatingSystem.IsMacCatalyst())
34+
// Only normalize if needed. APFS/Android layers NFD-decompose Base4K codepoints,
35+
// but Dokany/WinFsp deliver names in a form where NFC recomposition breaks lookup.
36+
// IsNormalized() lets the string itself determine whether normalization is safe.
37+
if (!nameWithoutExtension.IsNormalized(NormalizationForm.FormC))
3538
{
3639
var normalizedLength = nameWithoutExtension.GetNormalizedLength(NormalizationForm.FormC);
3740
var normalized = new char[normalizedLength];

0 commit comments

Comments
 (0)