Skip to content
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nixamp",
"version": "0.72.0",
"version": "0.72.1",
"description": "It really whips the terminal's ass. A Winamp-shaped audio player for your terminal.",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion src/guide-vods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ export async function handleVods(request: IncomingMessage, response: ServerRespo
return true;
}
// The file's own server sends it, as an attachment.
response.writeHead(302, { location: `${vod.play}&download=1`, "cache-control": "private, no-store", "referrer-policy": "no-referrer" });
response.writeHead(302, { location: `${vod.play}&download=1&name=${encodeURIComponent(vod.name)}`, "cache-control": "private, no-store", "referrer-policy": "no-referrer" });
response.end();
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/library-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ export async function handleLibrary(
if (itemMatch[2] === "play" && ctx.play) {
// `download=1`: the same file as an attachment, named for what it is (a bought VOD download).
const named = url.searchParams.get("download") === "1"
? (item.override.title || item.title || item.path.split("/").pop()!.replace(/\.[^.]+$/, "")).replace(/[\\/:*?"<>|\x00-\x1f]/g, "").slice(0, 160) || item.id
? (url.searchParams.get("name") || item.override.title || item.title || item.path.split("/").pop()!.replace(/\.[^.]+$/, "")).replace(/[\\/:*?"<>|\x00-\x1f]/g, "").slice(0, 160) || item.id
: "";
await ctx.play(request, response, item.path, named || undefined);
return true;
Expand Down
2 changes: 1 addition & 1 deletion test/guide-vods.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ test("the owner prices its own sellable file; a bought grant redirects to the fi
const download = (g: string) => fetch(`${base}/api/v1/guide/vods/${vod.id}/download?grant=${g}`, { redirect: "manual" });
const ok = await download("good");
assert.equal(ok.status, 302);
assert.equal(ok.headers.get("location"), `${PLAY}&download=1`);
assert.equal(ok.headers.get("location"), `${PLAY}&download=1&name=Nosferatu`);
assert.equal((await download("other")).status, 403, "a grant for another video");
assert.equal((await download("bad")).status, 403);
// A member may not put a price on anything.
Expand Down
Loading