summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-08-02 19:25:56 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-08-02 19:25:56 +1000
commit8ec17b74cbdac76d0ebf2a822d3ecb0479154e7e (patch)
tree98f69adb5bd596b3d5f00407b0d737d2733039eb
parentFix messages?after=snowflake calling new Snowflake, which is not allwoed (diff)
downloadserver-8ec17b74cbdac76d0ebf2a822d3ecb0479154e7e.tar.xz
Fix before and after queries doing gt and lt comparisions incorrectly
-rw-r--r--api/src/routes/channels/#channel_id/messages/index.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/api/src/routes/channels/#channel_id/messages/index.ts b/api/src/routes/channels/#channel_id/messages/index.ts
index 6c759cd7..849968f9 100644
--- a/api/src/routes/channels/#channel_id/messages/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/index.ts
@@ -109,11 +109,11 @@ router.get("/", async (req: Request, res: Response) => {
 	};
 
 	if (after) {
-		if (after > Snowflake.generate()) return res.status(422);
+		if (BigInt(after) > BigInt(Snowflake.generate())) return res.status(422);
 		query.where.id = MoreThan(after);
 	}
 	else if (before) { 
-		if (before < req.params.channel_id) return res.status(422);
+		if (BigInt(before) < BigInt(req.params.channel_id)) return res.status(422);
 		query.where.id = LessThan(before);
 	}
 	else if (around) {