You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-06-15 03:30:33 +02:00
fix(web+mobile): consistent filename handling (#2534)
This commit is contained in:
@ -108,8 +108,17 @@ export async function bulkDownload(
|
||||
* an empty string when not found.
|
||||
*/
|
||||
export function getFilenameExtension(filename: string): string {
|
||||
const lastIndex = filename.lastIndexOf('.');
|
||||
return filename.slice(lastIndex + 1).toLowerCase();
|
||||
const lastIndex = Math.max(0, filename.lastIndexOf('.'));
|
||||
const startIndex = (lastIndex || Infinity) + 1;
|
||||
return filename.slice(startIndex).toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the filename of an asset including file extension
|
||||
*/
|
||||
export function getAssetFilename(asset: AssetResponseDto): string {
|
||||
const fileExtension = getFilenameExtension(asset.originalPath);
|
||||
return `${asset.originalFileName}.${fileExtension}`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user