mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-20 13:51:12 +02:00
Merge branch 'master' into develop
This commit is contained in:
@@ -285,7 +285,7 @@ define('forum/category/tools', [
|
||||
}
|
||||
|
||||
async function onTopicMoved(data) {
|
||||
if (ajaxify.data.template.category) {
|
||||
if (ajaxify.data.template.category || String(data.toCid) === '-1') {
|
||||
getTopicEl(data.tid).remove();
|
||||
} else {
|
||||
const category = await api.get(`/categories/${data.toCid}`);
|
||||
|
||||
@@ -273,10 +273,19 @@ middleware.buildSkinAsset = helpers.try(async (req, res, next) => {
|
||||
middleware.addUploadHeaders = function addUploadHeaders(req, res, next) {
|
||||
// Trim uploaded files' timestamps when downloading + force download if html
|
||||
let basename = path.basename(req.path);
|
||||
const extname = path.extname(req.path);
|
||||
if (req.path.startsWith('/uploads/files/') && middleware.regexes.timestampedUpload.test(basename)) {
|
||||
basename = basename.slice(14);
|
||||
res.header('Content-Disposition', `${extname.startsWith('.htm') ? 'attachment' : 'inline'}; filename="${basename}"`);
|
||||
const extname = path.extname(req.path).toLowerCase();
|
||||
const unsafeExtensions = [
|
||||
'.html', '.htm', '.xhtml', '.mht', '.mhtml', '.stm', '.shtm', '.shtml',
|
||||
'.svg', '.svgz',
|
||||
'.xml', '.xsl', '.xslt',
|
||||
];
|
||||
const isInlineSafe = !unsafeExtensions.includes(extname);
|
||||
const dispositionType = isInlineSafe ? 'inline' : 'attachment';
|
||||
if (req.path.startsWith('/uploads/files/')) {
|
||||
if (middleware.regexes.timestampedUpload.test(basename)) {
|
||||
basename = basename.slice(14);
|
||||
}
|
||||
res.header('Content-Disposition', `${dispositionType}; filename="${basename}"`);
|
||||
}
|
||||
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user