Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix sorting of folder containing [] in the name #1521

Stanimir09215a9a29c2
diff --git a/app/utils/misc.ts b/app/utils/misc.ts
index 167ac413e..8eb2368e5 100644
--- a/app/utils/misc.ts
+++ b/app/utils/misc.ts
@@ -553,9 +553,13 @@ export function sortAlphaNum(a: TS.FileSystemEntry, b: TS.FileSystemEntry) {
// Regular expression to test if the string has a digit.
const reDigit = /\d/;
- // Get rid of casing issues.
- const cleanedA = cleanFileName(a.name.toLowerCase());
- const cleanedB = cleanFileName(b.name.toLowerCase());
+ // Get rid of casing issues && remove tags for files only (folders dont have tags in name)
+ const cleanedA = a.isFile
+ ? cleanFileName(a.name.toLowerCase())
+ : a.name.toLowerCase();
+ const cleanedB = b.isFile
+ ? cleanFileName(b.name.toLowerCase())
+ : b.name.toLowerCase();
// Separates the strings into substrings that have only digits and those
// that have no digits.