feat(server): Storage template support album condition (#12000)

feat(server): Storage template support album condition ([Request](https://github.com/immich-app/immich/discussions/11999))
This commit is contained in:
Mark
2024-08-27 03:48:39 +02:00
committed by GitHub
parent 9894b9513b
commit b051b29eca
2 changed files with 45 additions and 3 deletions

View File

@@ -308,7 +308,7 @@ export class StorageTemplateService {
filetypefull: asset.type == AssetType.IMAGE ? 'IMAGE' : 'VIDEO',
assetId: asset.id,
//just throw into the root if it doesn't belong to an album
album: (albumName && sanitize(albumName.replaceAll(/\.+/g, ''))) || '.',
album: (albumName && sanitize(albumName.replaceAll(/\.+/g, ''))) || '',
};
const systemTimeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;
@@ -329,6 +329,6 @@ export class StorageTemplateService {
substitutions[token] = dt.toFormat(token);
}
return template(substitutions);
return template(substitutions).replaceAll(/\/{2,}/gm, '/');
}
}