Fix: enforce image fallback and remove fileLimiter from uploads routes

This commit is contained in:
dev
2026-10-28 15:30:38 +03:00
parent 617ed60e65
commit dd934baf5d
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -30,7 +30,7 @@
text = text.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g, (m, alt, src) => {
const url = safeUrl(src.replace(/&/g, '&'));
if (!url) return alt;
return `<img src="${esc(thumbUrl(url))}" data-img="${esc(url)}" alt="${esc(alt)}" loading="lazy">`;
return `<img src="${esc(thumbUrl(url))}" data-img="${esc(url)}" alt="${esc(alt)}" loading="lazy" onerror="this.onerror=null;this.src='${esc(url)}'">`;
});
text = text.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (m, label, href) => {
const url = safeUrl(href.replace(/&amp;/g, '&'));
+1 -1
View File
@@ -878,7 +878,7 @@ app.get('/uploads/thumb/:name', async (req, res) => {
return sendImageThumb(res, name);
});
app.get('/uploads/.originals/:name', fileLimiter, async (req, res) => {
app.get('/uploads/.originals/:name', async (req, res) => {
const name = req.params.name;
if (!/^[A-Za-z0-9._-]+$/.test(name)) return res.status(400).end();
return sendImageThumb(res, `.originals/${name}`);