fix: preserve discord inbound media filenames

This commit is contained in:
Peter Steinberger
2026-05-02 09:53:19 +01:00
parent 803b7ab808
commit 127da4c3ca
3 changed files with 10 additions and 1 deletions

View File

@@ -295,6 +295,7 @@ async function appendResolvedMediaFromAttachments(params: {
fetched.contentType ?? attachment.content_type,
"inbound",
params.maxBytes,
attachment.filename,
);
params.out.push({
path: saved.path,
@@ -402,6 +403,7 @@ async function appendResolvedMediaFromStickers(params: {
fetched.contentType,
"inbound",
params.maxBytes,
candidate.fileName,
);
params.out.push({
path: saved.path,

View File

@@ -94,7 +94,13 @@ function expectSinglePngDownload(params: {
});
expectDiscordCdnSsrFPolicy(call.ssrfPolicy);
expect(saveMediaBuffer).toHaveBeenCalledTimes(1);
expect(saveMediaBuffer).toHaveBeenCalledWith(expect.any(Buffer), "image/png", "inbound", 512);
expect(saveMediaBuffer).toHaveBeenCalledWith(
expect.any(Buffer),
"image/png",
"inbound",
512,
params.filePathHint,
);
expect(params.result).toEqual([
{
path: params.expectedPath,