Skip to content

Commit

Permalink
fix(sorting): The display name attribute is called displayname not …
Browse files Browse the repository at this point in the history
…`displayName` for DAV

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jun 18, 2024
1 parent 349e7bd commit 450fb37
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions __tests__/utils/fileSorting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ describe('sortNodes', () => {
mtime: new Date(100),
size: 100,
attributes: {
displayName: 'a',
displayname: 'a',
},
}),
file('b', 100, 100),
Expand All @@ -95,7 +95,7 @@ describe('sortNodes', () => {
mtime: new Date(100),
size: 100,
attributes: {
displayName: 'a',
displayname: 'a',
},
}),
// File with basename "b" but displayname "a"
Expand All @@ -107,7 +107,7 @@ describe('sortNodes', () => {
mtime: new Date(100),
size: 100,
attributes: {
displayName: 'a',
displayname: 'a',
},
}),
]
Expand Down
6 changes: 3 additions & 3 deletions lib/utils/fileSorting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ export function sortNodes(nodes: readonly INode[], options: FilesSortingOptions
...(sortingOptions.sortFavoritesFirst ? [(v: INode) => v.attributes?.favorite !== 1] : []),
// 2: Sort folders first if sorting by name
...(sortingOptions.sortFoldersFirst ? [(v: INode) => v.type !== 'folder'] : []),
// 3: Use sorting mode if NOT basename (to be able to use displayName too)
// 3: Use sorting mode if NOT basename (to be able to use displayname too)
...(sortingOptions.sortingMode !== FilesSortingMode.Name ? [(v: INode) => v[sortingOptions.sortingMode]] : []),
// 4: Use displayName if available, fallback to name
(v: INode) => basename(v.attributes?.displayName || v.basename),
// 4: Use displayname if available, fallback to name
(v: INode) => basename(v.attributes?.displayname || v.basename),
// 5: Finally, use basename if all previous sorting methods failed
(v: INode) => v.basename,
]
Expand Down

0 comments on commit 450fb37

Please sign in to comment.