fix(api): remove redundant decodeURIComponent in deleteSuppression

This commit is contained in:
coo1estguy
2026-09-19 15:00:59 +05:30
parent 1a6ba84b3a
commit ace80fe5a1
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -1840,7 +1840,7 @@ code{background:#f4f4f5;padding:.1rem .35rem;border-radius:4px}</style>
and(
eq(suppressions.projectId, ctx.projectId!),
eq(suppressions.channel, channel as any),
eq(suppressions.target, normaliseTarget(decodeURIComponent(target))),
eq(suppressions.target, normaliseTarget(target)),
),
);
+12
View File
@@ -272,6 +272,18 @@ describe("API compliance handlers", () => {
expect(mockDb.deletes[0]!.table).toBe(suppressions);
});
it("handles targets with special characters correctly", async () => {
const res = createMockRes();
await handlers.deleteSuppression(
createMockReq(),
res,
ctx({ params: { channel: "email", target: "alice+tag@example.com" } }),
);
expect(res.statusCode).toBe(204);
expect(mockDb.deletes).toHaveLength(1);
});
it("400s when the channel or target segment is missing", async () => {
const res = createMockRes();
await handlers.deleteSuppression(createMockReq(), res, ctx({ params: { channel: "email" } }));