fix(server): check asset against multiple import paths (#17128)

* fix sql logic

* refactor: map import paths into not or sql statements

---------

Co-authored-by: Zack Pollard <zackpollard@ymail.com>
This commit is contained in:
Jonathan Jogenfors
2025-03-26 16:10:53 +01:00
committed by GitHub
parent c547d849d9
commit 9fbd6369b9
2 changed files with 131 additions and 1 deletions

View File

@@ -1062,7 +1062,10 @@ export class AssetRepository {
.where('isExternal', '=', true)
.where('libraryId', '=', asUuid(libraryId))
.where((eb) =>
eb.or([eb('originalPath', 'not like', paths.join('|')), eb('originalPath', 'like', exclusions.join('|'))]),
eb.or([
eb.not(eb.or(paths.map((path) => eb('originalPath', 'like', path)))),
eb('originalPath', 'like', exclusions.join('|')),
]),
)
.executeTakeFirstOrThrow();
}