Add ESLint (#941)
* Add eslint, switch to lint-staged for precommit * Fix all ESLint errors * Update GH workflow to check prettier and eslint
This commit is contained in:
@@ -28,7 +28,7 @@ import ExifTransformer from "exif-be-gone";
|
||||
function getPath(path: string) {
|
||||
// STORAGE_LOCATION has a default value in start.ts
|
||||
const root = process.env.STORAGE_LOCATION || "../";
|
||||
var filename = join(root, path);
|
||||
const filename = join(root, path);
|
||||
|
||||
if (path.indexOf("\0") !== -1 || !filename.startsWith(root))
|
||||
throw new Error("invalid path");
|
||||
@@ -51,15 +51,15 @@ export class FileStorage implements Storage {
|
||||
}
|
||||
}
|
||||
|
||||
async set(path: string, value: any) {
|
||||
async set(path: string, value: Buffer) {
|
||||
path = getPath(path);
|
||||
if (!fs.existsSync(dirname(path)))
|
||||
fs.mkdirSync(dirname(path), { recursive: true });
|
||||
|
||||
value = Readable.from(value);
|
||||
const ret = Readable.from(value);
|
||||
const cleaned_file = fs.createWriteStream(path);
|
||||
|
||||
return value.pipe(new ExifTransformer()).pipe(cleaned_file);
|
||||
ret.pipe(new ExifTransformer()).pipe(cleaned_file);
|
||||
}
|
||||
|
||||
async delete(path: string) {
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
import { FileStorage } from "./FileStorage";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
import { bgCyan, black } from "picocolors";
|
||||
import { S3 } from "@aws-sdk/client-s3";
|
||||
import { S3Storage } from "./S3Storage";
|
||||
process.cwd();
|
||||
|
||||
Reference in New Issue
Block a user