mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix(federation): 🐛 Correctly handle non-lowercase acct queries in account lookups
This commit is contained in:
parent
259fba17a7
commit
340ed7b258
|
|
@ -34,4 +34,28 @@ describe(meta.route, () => {
|
|||
}),
|
||||
);
|
||||
});
|
||||
|
||||
test("should automatically lowercase the acct", async () => {
|
||||
const response = await fakeRequest(
|
||||
`${meta.route}?acct=${users[0].data.username.toUpperCase()}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${tokens[0].data.accessToken}`,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
expect(response.status).toBe(200);
|
||||
|
||||
const data = (await response.json()) as ApiAccount[];
|
||||
expect(data).toEqual(
|
||||
expect.objectContaining({
|
||||
id: users[0].id,
|
||||
username: users[0].data.username,
|
||||
display_name: users[0].data.displayName,
|
||||
avatar: expect.any(String),
|
||||
header: expect.any(String),
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export const meta = applyConfig({
|
|||
|
||||
export const schemas = {
|
||||
query: z.object({
|
||||
acct: z.string().min(1).max(512),
|
||||
acct: z.string().min(1).max(512).toLowerCase(),
|
||||
}),
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue