feat(server): natural file name sort for folder view

pull/28617/head
Alex Logashov 2026-05-25 14:54:14 -05:00
parent c28e5f90b6
commit c91365a031
No known key found for this signature in database
1 changed files with 6 additions and 1 deletions

View File

@ -11,6 +11,11 @@ export class ViewService extends BaseService {
async getAssetsByOriginalPath(auth: AuthDto, path: string): Promise<AssetResponseDto[]> {
const assets = await this.viewRepository.getAssetsByOriginalPath(auth.user.id, path);
return assets.map((asset) => mapAsset(asset, { auth }));
const nsCollator = new Intl.Collator(undefined, { numeric: true, sensitivity: 'base' });
return assets.map((asset) => mapAsset(asset, { auth })).sort(({ originalFileName: name1 }, { originalFileName: name2 }) =>
nsCollator.compare(name1, name2),
);
}
}