mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
fix(server): Allow commas and braces in import paths (#13259)
fix commas and braces in paths
This commit is contained in:
parent
94d213bbb9
commit
5b00bc499f
2 changed files with 65 additions and 6 deletions
|
|
@ -156,7 +156,9 @@ export class StorageRepository implements IStorageRepository {
|
|||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
return glob(this.asGlob(pathsToCrawl), {
|
||||
const globbedPaths = pathsToCrawl.map((path) => this.asGlob(path));
|
||||
|
||||
return glob(globbedPaths, {
|
||||
absolute: true,
|
||||
caseSensitiveMatch: false,
|
||||
onlyFiles: true,
|
||||
|
|
@ -172,7 +174,9 @@ export class StorageRepository implements IStorageRepository {
|
|||
return emptyGenerator();
|
||||
}
|
||||
|
||||
const stream = globStream(this.asGlob(pathsToCrawl), {
|
||||
const globbedPaths = pathsToCrawl.map((path) => this.asGlob(path));
|
||||
|
||||
const stream = globStream(globbedPaths, {
|
||||
absolute: true,
|
||||
caseSensitiveMatch: false,
|
||||
onlyFiles: true,
|
||||
|
|
@ -206,10 +210,9 @@ export class StorageRepository implements IStorageRepository {
|
|||
return () => watcher.close();
|
||||
}
|
||||
|
||||
private asGlob(pathsToCrawl: string[]): string {
|
||||
const escapedPaths = pathsToCrawl.map((path) => escapePath(path));
|
||||
const base = escapedPaths.length === 1 ? escapedPaths[0] : `{${escapedPaths.join(',')}}`;
|
||||
private asGlob(pathToCrawl: string): string {
|
||||
const escapedPath = escapePath(pathToCrawl);
|
||||
const extensions = `*{${mimeTypes.getSupportedFileExtensions().join(',')}}`;
|
||||
return `${base}/**/${extensions}`;
|
||||
return `${escapedPath}/**/${extensions}`;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue