fix: type the capped feed reader and the invitation sender lookup

This commit is contained in:
Linus Rath
2026-10-19 01:32:23 +02:00
parent 0b01a2d066
commit 5632097971
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -24,7 +24,7 @@ function getFetchTimeoutMs(maxBytes: number): number {
* upstream connection is aborted rather than drained.
*/
async function readBodyCapped(
response: { body: ReadableStream<Uint8Array> | null; arrayBuffer: () => Promise<ArrayBuffer> },
response: Pick<Response, 'body' | 'arrayBuffer'>,
maxBytes: number,
controller: AbortController,
): Promise<ArrayBuffer | null> {
@@ -39,13 +39,14 @@ async function readBodyCapped(
const { done, value } = await reader.read();
if (done) break;
if (!value) continue;
received += value.byteLength;
const chunk = value as Uint8Array;
received += chunk.byteLength;
if (received > maxBytes) {
controller.abort();
reader.cancel().catch(() => {});
return null;
}
chunks.push(value);
chunks.push(chunk);
}
const out = new Uint8Array(received);
let offset = 0;
+1 -1
View File
@@ -209,7 +209,7 @@ function getOrganizerEmail(event: Partial<CalendarEvent>): string | null {
* the bare `spf=pass` made the forged invitation look trusted.
*/
function hasVerifiedAuthentication(email?: Pick<Email, 'from' | 'authenticationResults'>): boolean {
return hasAlignedAuthenticationPass(email?.authenticationResults, getPrimaryAddressEmail(email?.from));
return hasAlignedAuthenticationPass(email?.authenticationResults, getPrimaryAddressEmail(email?.from) ?? undefined);
}
function hasAuthenticationFailure(email?: Pick<Email, 'authenticationResults'>): boolean {