diff options
author | Catalan Lover <48515417+FSG-Cat@users.noreply.github.com> | 2022-08-23 23:50:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-23 23:50:01 +0200 |
commit | d63451b3fe6c0c6ab175adec82361834bb3633f5 (patch) | |
tree | b738ee25bf9819300e1802ba9a8e2813e9dc2588 /src/cdn/util/FileStorage.ts | |
parent | Merge pull request #1 from FSG-Cat/FSG-Cat-patch-1 (diff) | |
parent | Check Captcha (diff) | |
download | server-d63451b3fe6c0c6ab175adec82361834bb3633f5.tar.xz |
Merge branch 'fosscord:staging' into Bug-Report-Template
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); |