summary refs log tree commit diff
path: root/api/src/routes
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-25 23:54:52 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-09-25 23:54:52 +0200
commit202a8bd187c826889a0ee473794fdc92b867f0b8 (patch)
tree5297854f3a80e13ee45c09f01126d8992a4e1f8d /api/src/routes
parent:lock: XSS content type: html (diff)
downloadserver-202a8bd187c826889a0ee473794fdc92b867f0b8.tar.xz
:bug: message attachment url
Diffstat (limited to 'api/src/routes')
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts
index fab20977..d3321fae 100644
--- a/api/src/routes/channels/#channel_id/messages/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/index.ts
@@ -3,6 +3,7 @@ import {
 	Attachment,
 	Channel,
 	ChannelType,
+	Config,
 	DmChannelDTO,
 	Embed,
 	emitEvent,
@@ -15,6 +16,7 @@ import { HTTPError } from "lambert-server";
 import { handleMessage, postHandleMessage, route } from "@fosscord/api";
 import multer from "multer";
 import { FindManyOptions, LessThan, MoreThan } from "typeorm";
+import { URL } from "url";
 
 const router: Router = Router();
 
@@ -111,6 +113,9 @@ router.get("/", async (req: Request, res: Response) => {
 			});
 			// @ts-ignore
 			if (!x.author) x.author = { discriminator: "0000", username: "Deleted User", public_flags: "0", avatar: null };
+			x.attachments?.forEach((x) => {
+				x.proxy_url = `${Config.get().cdn.endpointPublic || "http://localhost:3003"}${new URL(x.proxy_url).pathname}`;
+			});
 
 			return x;
 		})