Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .server-changes/transcript-download-media-type-case.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
area: webapp
type: fix
---

Chat transcript downloads keep the .jsonl filename when the stored media type differs only in letter case.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,22 @@ minioTest(
}
);

test("uses a .jsonl filename for transcript media types regardless of case", () => {
for (const contentType of [
TRANSCRIPT_BLOB_CONTENT_TYPE.toUpperCase(),
"Application/Vnd.Trigger.Transcript+Ndjson; charset=utf-8",
]) {
const object = new Response('{"version":2}\n', {
headers: { "Content-Type": contentType },
});
const response = downloadTranscript(object, "packets/download/snapshot.json");
expect(response.headers.get("Content-Disposition")).toBe(
'attachment; filename="snapshot.jsonl"'
);
expect(response.headers.get("Content-Type")).toBe(contentType);
}
});

test("does not treat permission or service failures as an absent transcript", () => {
expect(isTranscriptNotFound(new Error("Failed to download from object store: Forbidden"))).toBe(
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ export function downloadTranscript(
): Response {
const storedFilename = basename(storagePath).replace(/[^a-zA-Z0-9._-]/g, "_") || "transcript";
const contentType = object.headers.get("Content-Type") ?? "application/octet-stream";
// Media type and subtype are case-insensitive (RFC 9110). Parameters after ";" are ignored.
const filename =
contentType.split(";")[0]?.trim() === TRANSCRIPT_BLOB_CONTENT_TYPE
contentType.split(";")[0]?.trim().toLowerCase() === TRANSCRIPT_BLOB_CONTENT_TYPE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Pagination still rejects mixed-case media types

For a mixed-case stored media type, readSuffix skips ranged reads. Dashboard pagination then fetches the whole transcript on every page, despite the download recognizing its format.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

? `${basename(storedFilename, extname(storedFilename))}.jsonl`
: storedFilename;
// Errors after the route returns must still be logged and reach the HTTP adapter,
Expand Down