1 files changed, 4 insertions, 7 deletions
diff --git a/src/cdn/util/FileStorage.ts b/src/cdn/util/FileStorage.ts
index eefdebc1..94f7ab14 100644
--- a/src/cdn/util/FileStorage.ts
+++ b/src/cdn/util/FileStorage.ts
@@ -29,8 +29,7 @@ function getPath(path: string) {
const root = process.env.STORAGE_LOCATION || "../";
const filename = join(root, path);
- if (path.indexOf("\0") !== -1 || !filename.startsWith(root))
- throw new Error("invalid path");
+ if (path.indexOf("\0") !== -1 || !filename.startsWith(root)) throw new Error("invalid path");
return filename;
}
@@ -54,17 +53,15 @@ export class FileStorage implements Storage {
path = getPath(path);
newPath = getPath(newPath);
- if (!fs.existsSync(dirname(newPath)))
- fs.mkdirSync(dirname(newPath), { recursive: true });
+ if (!fs.existsSync(dirname(newPath))) fs.mkdirSync(dirname(newPath), { recursive: true });
// use reflink if possible, in order to not duplicate files at the block layer...
- fs.copyFileSync(path, newPath, fs.constants.COPYFILE_FICLONE)
+ fs.copyFileSync(path, newPath, fs.constants.COPYFILE_FICLONE);
}
async set(path: string, value: Buffer) {
path = getPath(path);
- if (!fs.existsSync(dirname(path)))
- fs.mkdirSync(dirname(path), { recursive: true });
+ if (!fs.existsSync(dirname(path))) fs.mkdirSync(dirname(path), { recursive: true });
const ret = Readable.from(value);
const cleaned_file = fs.createWriteStream(path);
|