diff --git a/src/cdn/util/FileStorage.ts b/src/cdn/util/FileStorage.ts
index 10b36743..5e53081b 100644
--- a/src/cdn/util/FileStorage.ts
+++ b/src/cdn/util/FileStorage.ts
@@ -30,8 +30,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;
}
@@ -53,8 +52,7 @@ export class FileStorage implements Storage {
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);
diff --git a/src/cdn/util/S3Storage.ts b/src/cdn/util/S3Storage.ts
index 81acd945..fd079ef0 100644
--- a/src/cdn/util/S3Storage.ts
+++ b/src/cdn/util/S3Storage.ts
@@ -29,11 +29,7 @@ const readableToBuffer = (readable: Readable): Promise<Buffer> =>
});
export class S3Storage implements Storage {
- public constructor(
- private client: S3,
- private bucket: string,
- private basePath?: string,
- ) {}
+ public constructor(private client: S3, private bucket: string, private basePath?: string) {}
/**
* Always return a string, to ensure consistency.
diff --git a/src/cdn/util/Storage.ts b/src/cdn/util/Storage.ts
index 26289af6..609e38e9 100644
--- a/src/cdn/util/Storage.ts
+++ b/src/cdn/util/Storage.ts
@@ -49,16 +49,12 @@ if (process.env.STORAGE_PROVIDER === "file" || !process.env.STORAGE_PROVIDER) {
bucket = process.env.STORAGE_BUCKET;
if (!region) {
- console.error(
- `[CDN] You must provide a region when using the S3 storage provider.`,
- );
+ console.error(`[CDN] You must provide a region when using the S3 storage provider.`);
process.exit(1);
}
if (!bucket) {
- console.error(
- `[CDN] You must provide a bucket when using the S3 storage provider.`,
- );
+ console.error(`[CDN] You must provide a bucket when using the S3 storage provider.`);
process.exit(1);
}
@@ -66,9 +62,7 @@ if (process.env.STORAGE_PROVIDER === "file" || !process.env.STORAGE_PROVIDER) {
let location = process.env.STORAGE_LOCATION;
if (!location) {
- console.warn(
- `[CDN] STORAGE_LOCATION unconfigured for S3 provider, defaulting to the bucket root...`,
- );
+ console.warn(`[CDN] STORAGE_LOCATION unconfigured for S3 provider, defaulting to the bucket root...`);
location = undefined;
}
|