summary refs log tree commit diff
path: root/api/src
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-04 11:23:12 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-04 11:23:12 +0200
commit6e9d4ed6a0cf018588d90d09a6dda2a67d545f26 (patch)
tree211aca0c08e3dda62cb68ba730fafa7c2113589f /api/src
parentMerge branch 'master' of https://github.com/fosscord/fosscord-api (diff)
downloadserver-6e9d4ed6a0cf018588d90d09a6dda2a67d545f26.tar.xz
:bug: fix error handler and asset router
Diffstat (limited to 'api/src')
-rw-r--r--api/src/middlewares/ErrorHandler.ts2
-rw-r--r--api/src/middlewares/TestClient.ts2
2 files changed, 2 insertions, 2 deletions
diff --git a/api/src/middlewares/ErrorHandler.ts b/api/src/middlewares/ErrorHandler.ts
index 34827cab..179c5991 100644
--- a/api/src/middlewares/ErrorHandler.ts
+++ b/api/src/middlewares/ErrorHandler.ts
@@ -19,7 +19,7 @@ export function ErrorHandler(error: Error, req: Request, res: Response, next: Ne
 			code = error.code;
 			message = error.message;
 			httpcode = error.httpStatus;
-		} else if (error as EntityNotFoundError) {
+		} else if (error instanceof EntityNotFoundError) {
 			message = `${(error as any).stringifyTarget} could not be found`;
 			code = 404;
 		} else if (error instanceof FieldError) {
diff --git a/api/src/middlewares/TestClient.ts b/api/src/middlewares/TestClient.ts
index 75fdf650..73e7b9c2 100644
--- a/api/src/middlewares/TestClient.ts
+++ b/api/src/middlewares/TestClient.ts
@@ -22,7 +22,7 @@ export default function TestClient(app: Application) {
 		html = html.replace(/GATEWAY_ENDPOINT: .+/, `GATEWAY_ENDPOINT: \`${GATEWAY_ENDPOINT}\`,`);
 	}
 
-	app.use("/assets", express.static(path.join(__dirname, "..", "assets")));
+	app.use("/assets", express.static(path.join(__dirname, "..", "..", "assets")));
 
 	app.get("/assets/:file", async (req: Request, res: Response) => {
 		delete req.headers.host;