summary refs log tree commit diff
path: root/src/cdn/util
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-08-22 22:16:11 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-08-22 22:16:11 +1000
commit8720744091e71efe0b2e5f88956e1e0a2e9ef702 (patch)
treef00521f59f3c2ece7e790f2d0b8469c051586a92 /src/cdn/util
parentActually respect with_mutual_guilds (diff)
parentMerge remote-tracking branch 'Puyodead1/patch/prettier-config' into staging (diff)
downloadserver-8720744091e71efe0b2e5f88956e1e0a2e9ef702.tar.xz
Merge remote-tracking branch 'upstream/staging' into fix/sendMemberInProfile
Diffstat (limited to '')
-rw-r--r--src/cdn/util/FileStorage.ts (renamed from cdn/src/util/FileStorage.ts)10
-rw-r--r--src/cdn/util/S3Storage.ts (renamed from cdn/src/util/S3Storage.ts)0
-rw-r--r--src/cdn/util/Storage.ts (renamed from cdn/src/util/Storage.ts)6
-rw-r--r--src/cdn/util/index.ts (renamed from cdn/src/util/index.ts)0
-rw-r--r--src/cdn/util/multer.ts (renamed from cdn/src/util/multer.ts)0
5 files changed, 9 insertions, 7 deletions
diff --git a/cdn/src/util/FileStorage.ts b/src/cdn/util/FileStorage.ts

index 84ecf556..aee9d345 100644 --- a/cdn/src/util/FileStorage.ts +++ b/src/cdn/util/FileStorage.ts
@@ -1,17 +1,16 @@ 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 { Readable } from "stream"; -import ExifTransformer = require("exif-be-gone"); +//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"); @@ -36,7 +35,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); diff --git a/cdn/src/util/S3Storage.ts b/src/cdn/util/S3Storage.ts
index c4066817..c4066817 100644 --- a/cdn/src/util/S3Storage.ts +++ b/src/cdn/util/S3Storage.ts
diff --git a/cdn/src/util/Storage.ts b/src/cdn/util/Storage.ts
index 89dd5634..728804a0 100644 --- a/cdn/src/util/Storage.ts +++ b/src/cdn/util/Storage.ts
@@ -1,6 +1,7 @@ import { FileStorage } from "./FileStorage"; import path from "path"; -import fse from "fs-extra"; +//import fse from "fs-extra"; +import fs from "fs"; import { bgCyan, black } from "picocolors"; import { S3 } from "@aws-sdk/client-s3"; import { S3Storage } from "./S3Storage"; @@ -22,7 +23,8 @@ if (process.env.STORAGE_PROVIDER === "file" || !process.env.STORAGE_PROVIDER) { location = path.join(process.cwd(), "files"); } console.log(`[CDN] storage location: ${bgCyan(`${black(location)}`)}`); - fse.ensureDirSync(location); + //fse.ensureDirSync(location); + fs.mkdirSync(location, {recursive: true}); process.env.STORAGE_LOCATION = location; storage = new FileStorage(); diff --git a/cdn/src/util/index.ts b/src/cdn/util/index.ts
index 07a5c31a..07a5c31a 100644 --- a/cdn/src/util/index.ts +++ b/src/cdn/util/index.ts
diff --git a/cdn/src/util/multer.ts b/src/cdn/util/multer.ts
index bfdf6aff..bfdf6aff 100644 --- a/cdn/src/util/multer.ts +++ b/src/cdn/util/multer.ts