Rotate administrator keys with safe re-enable and exact retry
This commit is contained in:
1 parent
9cf8249398
commit
55b47ce039
20 files changed
+3072
-104
No files matched your search
+3
-2
@@ -22,9 +22,10 @@ export async function adminBody(request: Request, configuredOrigin?: string): Pr
|
||||
const { done, value } = await reader.read();
|
||||
if (done) break;
|
||||
size += value.byteLength;
|
||||
if (size > 2048) { void reader.cancel(); throw new AdminError('Request too large.', 413); }
|
||||
chunks.push(value);
|
||||
// Drain the request without retaining bytes beyond the limit.
|
||||
if (size <= 2048) chunks.push(value);
|
||||
}
|
||||
if (size > 2048) throw new AdminError('Request too large.', 413);
|
||||
const bytes = new Uint8Array(size);
|
||||
let offset = 0;
|
||||
for (const chunk of chunks) { bytes.set(chunk, offset); offset += chunk.byteLength; }
|
||||
|
||||
Reference in new issue
Block a user