added cleanup to more sections

This commit is contained in:
Marie 2025-05-08 19:46:42 +00:00
parent e40f3917f3
commit b218251b94

View file

@ -213,6 +213,7 @@ export class ApiCallService implements OnApplicationShutdown {
? request.headers.authorization.slice(7) ? request.headers.authorization.slice(7)
: fields['i']; : fields['i'];
if (token != null && typeof token !== 'string') { if (token != null && typeof token !== 'string') {
cleanup();
reply.code(400); reply.code(400);
return; return;
} }
@ -223,6 +224,7 @@ export class ApiCallService implements OnApplicationShutdown {
}, request, reply).then((res) => { }, request, reply).then((res) => {
this.send(reply, res); this.send(reply, res);
}).catch((err: ApiError) => { }).catch((err: ApiError) => {
cleanup();
this.#sendApiError(reply, err); this.#sendApiError(reply, err);
}); });
@ -230,6 +232,7 @@ export class ApiCallService implements OnApplicationShutdown {
this.logIp(request, user); this.logIp(request, user);
} }
}).catch(err => { }).catch(err => {
cleanup();
this.#sendAuthenticationError(reply, err); this.#sendAuthenticationError(reply, err);
}); });
} }