fileName now take the upload code

This commit is contained in:
Anaïs Saraiva
2026-08-15 11:45:20 +02:00
parent bdb418f613
commit adf37d43a3
3 changed files with 13 additions and 5 deletions
+2 -2
View File
@@ -2,7 +2,7 @@ import { lstat } from "node:fs/promises";
import { hasValidAuth, renderPasswordForm } from "../auth";
import { notFound } from "../http";
import { log } from "../log";
import { contentDisposition, fileIdFromKey, KEY_PATTERN, secretMatches } from "../security";
import { contentDisposition, downloadFileName, fileIdFromKey, KEY_PATTERN, secretMatches } from "../security";
import { isExpired, type Storage } from "../storage";
export async function handleDownload(
@@ -41,7 +41,7 @@ export async function handleDownload(
const headers = new Headers({
"content-type": meta.mimeType || "application/octet-stream",
"content-length": String(fileStat.size),
"content-disposition": contentDisposition(meta.originalName),
"content-disposition": contentDisposition(downloadFileName(rawKey, meta.originalName)),
"cache-control": "private, no-store",
"x-content-type-options": "nosniff",
"referrer-policy": "no-referrer",