feat(server,web) Semantic import path validation (#7076)
* add library validation api * chore: open api * show warning i UI * add flex row * fix e2e * tests * fix tests * enforce path validation * enforce validation on refresh * return 400 on bad import path * add limits to import paths * set response code to 200 * fix e2e * fix lint * fix test * restore e2e folder * fix import * use startsWith * icon color * notify user of failed validation * add parent div to validation * add docs to the import validation * improve library troubleshooting docs * fix button alignment --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
committed by
GitHub
parent
e7a875eadd
commit
b3c7bebbd4
@@ -12,12 +12,24 @@ import archiver from 'archiver';
|
||||
import chokidar, { WatchOptions } from 'chokidar';
|
||||
import { glob } from 'glob';
|
||||
import { constants, createReadStream, existsSync, mkdirSync } from 'node:fs';
|
||||
import fs, { copyFile, readdir, rename, utimes, writeFile } from 'node:fs/promises';
|
||||
import fs, { copyFile, readdir, rename, stat, utimes, writeFile } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
|
||||
export class FilesystemProvider implements IStorageRepository {
|
||||
private logger = new ImmichLogger(FilesystemProvider.name);
|
||||
|
||||
readdir = readdir;
|
||||
|
||||
copyFile = copyFile;
|
||||
|
||||
stat = stat;
|
||||
|
||||
writeFile = writeFile;
|
||||
|
||||
rename = rename;
|
||||
|
||||
utimes = utimes;
|
||||
|
||||
createZipStream(): ImmichZipStream {
|
||||
const archive = archiver('zip', { store: true });
|
||||
|
||||
@@ -50,14 +62,6 @@ export class FilesystemProvider implements IStorageRepository {
|
||||
}
|
||||
}
|
||||
|
||||
writeFile = writeFile;
|
||||
|
||||
rename = rename;
|
||||
|
||||
copyFile = copyFile;
|
||||
|
||||
utimes = utimes;
|
||||
|
||||
async checkFileExists(filepath: string, mode = constants.F_OK): Promise<boolean> {
|
||||
try {
|
||||
await fs.access(filepath, mode);
|
||||
@@ -79,8 +83,6 @@ export class FilesystemProvider implements IStorageRepository {
|
||||
}
|
||||
}
|
||||
|
||||
stat = fs.stat;
|
||||
|
||||
async unlinkDir(folder: string, options: { recursive?: boolean; force?: boolean }) {
|
||||
await fs.rm(folder, options);
|
||||
}
|
||||
@@ -146,6 +148,4 @@ export class FilesystemProvider implements IStorageRepository {
|
||||
|
||||
return () => watcher.close();
|
||||
}
|
||||
|
||||
readdir = readdir;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user