use decrementing amount of redirects

This makes `redirects` contain the number of remaining redirects, which
makes it easier to limit the number of further redirects that should be
allowed.
This commit is contained in:
Johann150 2024-03-30 14:30:54 +01:00
parent e2311a6f4b
commit 7e37a8fd88
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -96,7 +96,7 @@ export async function signedGet(_url: string, user: { id: User['id'] }): Promise
let url = _url;
const keypair = await getUserKeypair(user.id);
for (let redirects = 0; redirects < 3; redirects++) {
for (let redirects = 3; redirects > 0; redirects--) {
const req = createSignedGet({
key: {
privateKeyPem: keypair.privateKey,