From 941c35c1ef8efb73bce5069625a1fad23b0986fa Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 20 Feb 2025 06:12:31 +0100 Subject: [PATCH] Fix download endpoint --- server/core/controllers/download.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/core/controllers/download.ts b/server/core/controllers/download.ts index 21f3c80f1..628652aa7 100644 --- a/server/core/controllers/download.ts +++ b/server/core/controllers/download.ts @@ -25,7 +25,7 @@ import { import { MVideoSource } from '@server/types/models/video/video-source.js' import cors from 'cors' import express from 'express' -import { DOWNLOAD_PATHS } from '../initializers/constants.js' +import { DOWNLOAD_PATHS, WEBSERVER } from '../initializers/constants.js' import { asyncMiddleware, buildRateLimiter, optionalAuthenticate, originalVideoFileDownloadValidator, @@ -252,7 +252,7 @@ async function downloadGeneratedVideoFile (req: express.Request, res: express.Re : maxResolutionFile.extname // If there is the extension, we want to simulate a "raw file" and so not send the content disposition header - const urlPath = new URL(req.originalUrl).pathname + const urlPath = new URL(req.originalUrl, WEBSERVER.URL).pathname if (!urlPath.endsWith('.mp4') && !urlPath.endsWith('.m4a')) { const downloadFilename = buildDownloadFilename({ video, extname }) res.setHeader('Content-disposition', `attachment; filename="${encodeURI(downloadFilename)}`)