From 058a7ed320965d593083e170aae95f345703c188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Vestergaard=20V=C3=A6rum?= Date: Tue, 10 Sep 2024 23:45:04 +0200 Subject: [PATCH] fix: Only log deprecation warning for "Node.attributes.displayname" if `Node.displayname` is not available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ferdinand Thiessen Signed-off-by: Dennis Vestergaard Værum --- lib/utils/fileSorting.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/fileSorting.ts b/lib/utils/fileSorting.ts index ee251b1e..f8f6034d 100644 --- a/lib/utils/fileSorting.ts +++ b/lib/utils/fileSorting.ts @@ -65,7 +65,7 @@ export function sortNodes(nodes: readonly INode[], options: FilesSortingOptions // 3: Use sorting mode if NOT basename (to be able to use display name too) ...(sortingOptions.sortingMode !== FilesSortingMode.Name ? [(v: INode) => v[sortingOptions.sortingMode]] : []), // 4: Use display name if available, fallback to name - (v: INode) => basename(v.attributes?.displayname || v.basename), + (v: INode) => basename(v.displayname || v.attributes?.displayname || v.basename), // 5: Finally, use basename if all previous sorting methods failed (v: INode) => v.basename, ]