fix(server): prevent feedback loop during library scan (#7944)

* prevent feedback loop

* add nesting

* made nesting less ugly

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Mert 2024-03-15 18:01:58 -04:00 committed by GitHub
parent eea0a98090
commit a9438a9c2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 60 additions and 4 deletions

View file

@ -1,4 +1,6 @@
import { APP_MEDIA_LOCATION, THUMBNAIL_DIR } from '@app/domain';
import { LibraryEntity, LibraryType } from '@app/infra/entities';
import { join } from 'node:path';
import { userStub } from './user.stub';
export const libraryStub = {
@ -100,4 +102,18 @@ export const libraryStub = {
isVisible: true,
exclusionPatterns: ['**/dir1/**'],
}),
hasImmichPaths: Object.freeze<LibraryEntity>({
id: 'library-id1337',
name: 'importpath-exclusion-library1',
assets: [],
owner: userStub.admin,
ownerId: 'user-id',
type: LibraryType.EXTERNAL,
importPaths: [join(THUMBNAIL_DIR, 'library'), '/xyz', join(APP_MEDIA_LOCATION, 'library')],
createdAt: new Date('2023-01-01'),
updatedAt: new Date('2023-01-01'),
refreshedAt: null,
isVisible: true,
exclusionPatterns: ['**/dir1/**'],
}),
};