mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
feat(server): in upload folder, split the files into folders based on the first four of the files uuid (#6175)
This commit is contained in:
parent
2aaf941dda
commit
4cf1e553d2
6 changed files with 24 additions and 13 deletions
|
|
@ -71,6 +71,7 @@ export interface UploadRequest {
|
|||
}
|
||||
|
||||
export interface UploadFile {
|
||||
uuid: string;
|
||||
checksum: Buffer;
|
||||
originalPath: string;
|
||||
originalName: string;
|
||||
|
|
@ -170,13 +171,13 @@ export class AssetService {
|
|||
[UploadFieldName.PROFILE_DATA]: originalExt,
|
||||
};
|
||||
|
||||
return sanitize(`${this.cryptoRepository.randomUUID()}${lookup[fieldName]}`);
|
||||
return sanitize(`${file.uuid}${lookup[fieldName]}`);
|
||||
}
|
||||
|
||||
getUploadFolder({ auth, fieldName }: UploadRequest): string {
|
||||
getUploadFolder({ auth, fieldName, file }: UploadRequest): string {
|
||||
auth = this.access.requireUploadAccess(auth);
|
||||
|
||||
let folder = StorageCore.getFolderLocation(StorageFolder.UPLOAD, auth.user.id);
|
||||
let folder = StorageCore.getNestedFolder(StorageFolder.UPLOAD, auth.user.id, file.uuid);
|
||||
if (fieldName === UploadFieldName.PROFILE_DATA) {
|
||||
folder = StorageCore.getFolderLocation(StorageFolder.PROFILE, auth.user.id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue