Skip to content

Node.js based forum software built for the modern web

fix: download xml files

Barış Soner Uşaklı7142c008dbe4
diff --git a/src/routes/index.js b/src/routes/index.js
index 71f722f397..4a12a548ce 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -179,6 +179,11 @@ function addCoreRoutes(app, router, middleware, mounts) {
];
const staticOptions = {
maxAge: app.enabled('cache') ? 5184000000 : 0,
+ setHeaders: (res, filePath) => {
+ if (path.extname(filePath).toLowerCase() === '.xml') {
+ res.setHeader('Content-Disposition', `attachment; filename=${path.basename(filePath)}`);
+ }
+ },
};
if (path.resolve(__dirname, '../../public/uploads') !== nconf.get('upload_path')) {