mirror of
https://github.com/devkitshq/notifkit.git
synced 2026-10-19 18:24:52 +02:00
fix(api): remove redundant decodeURIComponent in deleteSuppression
This commit is contained in:
@@ -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)),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -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" } }));
|
||||
|
||||
Reference in New Issue
Block a user