Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Fix download endpoint

Chocobozzz941c35c1ef8e
diff --git a/server/core/controllers/download.ts b/server/core/controllers/download.ts
index 21f3c80f1a..628652aa70 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)}`)