diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-20 03:27:03 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-20 03:27:03 +0200 |
commit | 04dea8d788acfaf485f4aa9ad255e39f6aac2a08 (patch) | |
tree | 2a61e45ef6f313012a585a0a80c1fa5bfe3ddae8 /src/cdn/util/FileStorage.ts | |
parent | Fix merge conflicts (diff) | |
download | server-04dea8d788acfaf485f4aa9ad255e39f6aac2a08.tar.xz |
prettier
Diffstat (limited to 'src/cdn/util/FileStorage.ts')
-rw-r--r-- | src/cdn/util/FileStorage.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cdn/util/FileStorage.ts b/src/cdn/util/FileStorage.ts index aee9d345..fea013a6 100644 --- a/src/cdn/util/FileStorage.ts +++ b/src/cdn/util/FileStorage.ts @@ -1,7 +1,7 @@ -import { Storage } from "./Storage"; import fs from "fs"; -import { join, relative, dirname } from "path"; +import { dirname, join } from "path"; import { Readable } from "stream"; +import { Storage } from "./Storage"; //import ExifTransformer = require("exif-be-gone"); import ExifTransformer from "exif-be-gone"; @@ -12,8 +12,7 @@ function getPath(path: string) { const root = process.env.STORAGE_LOCATION || "../"; let 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; } @@ -36,7 +35,7 @@ export class FileStorage implements Storage { async set(path: string, value: any) { path = getPath(path); //fse.ensureDirSync(dirname(path)); - fs.mkdirSync(dirname(path), {recursive: true}); + fs.mkdirSync(dirname(path), { recursive: true }); value = Readable.from(value); const cleaned_file = fs.createWriteStream(path); |