Strip controls, line separators and bidi controls from offered file names

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
SchluffeandClaude Opus 5.5 committed 2026-10-30 00:38:10 +01:00
1 parent 7f4811485a
commit af0a8c9fee
3 files changed
+18 -12

No files matched your search

+11
View File
@@ -1142,6 +1142,17 @@ describe('receiving', () => {
}
});
it('strips controls, line separators and bidi controls from the offered name', async () => {
const { channel, session, check } = receiving();
check();
await until(() => channel.sent.length);
channel.receive({ name: 'invoice\u202Efdp.exe\n\u2028done\u0000\u009B\u2066', size: 1 });
expect(session.files).toMatchObject([{ name: 'invoicefdp.exedone' }]);
expect(session.logs.at(-1)).toBe('offered invoicefdp.exedone (1 bytes)');
session.files[0]!.download();
expect(saved.at(-1)!.file.name).toBe('invoicefdp.exedone');
});
it("saves the chunks in order, reports the download manager's reads and when it finished", async () => {
const { channel, session, handshake, download } = await downloading(3 * CHUNK_SIZE);
expect(handshake.start).toHaveBeenCalled();