fix: properly use path filter in local other video scanner

This commit is contained in:
Christian Benincasa
2026-01-23 09:32:52 -05:00
parent fe2a460546
commit 9ae60b3d09
2 changed files with 18 additions and 8 deletions

View File

@@ -119,17 +119,15 @@ export class LocalOtherVideoScanner extends FileSystemScanner {
break;
}
this.logger.debug('Scanning directory: %s', folder);
if (
isNonEmptyString(context.pathFilter) &&
!basename(folder)
.toLowerCase()
.startsWith(context.pathFilter.toLowerCase())
!context.pathFilter.toLowerCase().startsWith(folder.toLowerCase())
) {
continue;
}
this.logger.debug('Scanning directory: %s', folder);
const result = await Result.attemptAsync(() =>
this.scanFolder(folder, context),
);
@@ -202,6 +200,13 @@ export class LocalOtherVideoScanner extends FileSystemScanner {
private async scanFolder(fullPath: string, context: LocalScanContext) {
const parent = dirname(fullPath);
if (
isNonEmptyString(context.pathFilter) &&
!context.pathFilter.toLowerCase().startsWith(fullPath.toLowerCase())
) {
return;
}
// Find the existing parent folder if it exists
const parentFolder = await this.localMediaDB.findFolder(
context.library,
@@ -307,9 +312,15 @@ export class LocalOtherVideoScanner extends FileSystemScanner {
return;
}
await wait();
const fullFilePath = path.join(file.parentPath, file.name);
if (
isNonEmptyString(context.pathFilter) &&
!context.pathFilter.toLowerCase().startsWith(fullFilePath.toLowerCase())
) {
return;
}
await wait();
const mediaItem = (await this.getMediaItem(fullFilePath)).getOrThrow();

View File

@@ -22,7 +22,6 @@ export class SearchParser {
];
const r = this.preprocessSearchFilterInner(filter, mutators);
console.log(filter, r);
return r;
}