make project file tokens public; keep name links with image preview and file download

This commit is contained in:
dev
2026-09-06 11:35:40 +03:00
parent bd396195a8
commit aa6677472a
3 changed files with 4 additions and 9 deletions
+1 -1
View File
@@ -505,7 +505,7 @@ function isImageName(name) {
return /\.(jpe?g|png|gif|webp|bmp|avif|svg|ico)$/i.test(name || '');
}
app.get('/api/files/:token', requireAdmin, async (req, res) => {
app.get('/api/files/:token', async (req, res) => {
const { rows } = await pool.query('SELECT path, name FROM project_files WHERE token = $1', [req.params.token]);
if (!rows.length) return res.status(404).json({ error: 'Not found' });
const r = rows[0];