From 233372303b7ce2a7edffb534c447a8621ce449a8 Mon Sep 17 00:00:00 2001 From: Jonathan Jogenfors Date: Wed, 11 Sep 2024 16:40:52 +0200 Subject: [PATCH] feat(server): default exclusion patterns (#12566) * Add default exclusion patterns * simplify * fix tests --- e2e/src/api/specs/library.e2e-spec.ts | 4 ++-- server/src/services/library.service.spec.ts | 6 +++--- server/src/services/library.service.ts | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/e2e/src/api/specs/library.e2e-spec.ts b/e2e/src/api/specs/library.e2e-spec.ts index 2f6274d1fc..8d98e86630 100644 --- a/e2e/src/api/specs/library.e2e-spec.ts +++ b/e2e/src/api/specs/library.e2e-spec.ts @@ -83,7 +83,7 @@ describe('/libraries', () => { refreshedAt: null, assetCount: 0, importPaths: [], - exclusionPatterns: [], + exclusionPatterns: expect.any(Array), }), ); }); @@ -270,7 +270,7 @@ describe('/libraries', () => { refreshedAt: null, assetCount: 0, importPaths: [], - exclusionPatterns: [], + exclusionPatterns: expect.any(Array), }), ); }); diff --git a/server/src/services/library.service.spec.ts b/server/src/services/library.service.spec.ts index 2d4e1d5776..36bdfd05dc 100644 --- a/server/src/services/library.service.spec.ts +++ b/server/src/services/library.service.spec.ts @@ -892,7 +892,7 @@ describe(LibraryService.name, () => { expect.objectContaining({ name: expect.any(String), importPaths: [], - exclusionPatterns: [], + exclusionPatterns: expect.any(Array), }), ); }); @@ -917,7 +917,7 @@ describe(LibraryService.name, () => { expect.objectContaining({ name: 'My Awesome Library', importPaths: [], - exclusionPatterns: [], + exclusionPatterns: expect.any(Array), }), ); }); @@ -947,7 +947,7 @@ describe(LibraryService.name, () => { expect.objectContaining({ name: expect.any(String), importPaths: ['/data/images', '/data/videos'], - exclusionPatterns: [], + exclusionPatterns: expect.any(Array), }), ); }); diff --git a/server/src/services/library.service.ts b/server/src/services/library.service.ts index 2aa0df402a..3dd81dd613 100644 --- a/server/src/services/library.service.ts +++ b/server/src/services/library.service.ts @@ -245,7 +245,7 @@ export class LibraryService { ownerId: dto.ownerId, name: dto.name ?? 'New External Library', importPaths: dto.importPaths ?? [], - exclusionPatterns: dto.exclusionPatterns ?? [], + exclusionPatterns: dto.exclusionPatterns ?? ['**/@eaDir/**', '**/._*'], }); return mapLibrary(library); }