Encode Unicode video titles in playback response headers

This commit is contained in:
Towsty
2026-09-12 10:17:02 -05:00
parent d8f42ecc68
commit a9551911f2
2 changed files with 9 additions and 1 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
import { existsSync } from 'node:fs'
import { sendPathWithRange } from '~/server/utils/httpRange'
import { inlineFilename } from '~/shared/content-disposition.mjs'
export default defineEventHandler((event) => {
const { owner } = assertLibraryOwner(event)
@@ -11,7 +12,7 @@ export default defineEventHandler((event) => {
throw createError({ statusCode: 404, statusMessage: 'Video file is missing' })
}
return sendPathWithRange(event, path, 'video/mp4', {
'Content-Disposition': `inline; filename="${safeDownloadName(clipTitle(clip))}.mp4"`,
'Content-Disposition': inlineFilename(`${safeDownloadName(clipTitle(clip))}.mp4`),
'Cache-Control': 'private, max-age=0, must-revalidate'
})
})