1 files changed, 8 insertions, 9 deletions
diff --git a/cdn/src/util/FileStorage.ts b/src/cdn/util/FileStorage.ts
index 84ecf556..fea013a6 100644
--- a/cdn/src/util/FileStorage.ts
+++ b/src/cdn/util/FileStorage.ts
@@ -1,20 +1,18 @@
-import { Storage } from "./Storage";
import fs from "fs";
-import fse from "fs-extra";
-import { join, relative, dirname } from "path";
-import "missing-native-js-functions";
+import { dirname, join } from "path";
import { Readable } from "stream";
-import ExifTransformer = require("exif-be-gone");
+import { Storage } from "./Storage";
+//import ExifTransformer = require("exif-be-gone");
+import ExifTransformer from "exif-be-gone";
// TODO: split stored files into separate folders named after cloned route
function getPath(path: string) {
// STORAGE_LOCATION has a default value in start.ts
const root = process.env.STORAGE_LOCATION || "../";
- var filename = join(root, path);
+ 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 +34,8 @@ export class FileStorage implements Storage {
async set(path: string, value: any) {
path = getPath(path);
- fse.ensureDirSync(dirname(path));
+ //fse.ensureDirSync(dirname(path));
+ fs.mkdirSync(dirname(path), { recursive: true });
value = Readable.from(value);
const cleaned_file = fs.createWriteStream(path);
|