fixed 404 error
This commit is contained in:
@@ -1613,7 +1613,6 @@ app.get(`${basePath}/dashboard`, requireAuthPage, async (req, res) => {
|
|||||||
<div class="muted">Noch ${formatCountdown(item.expires_at)}</div>
|
<div class="muted">Noch ${formatCountdown(item.expires_at)}</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<button type="button" class="secondary copy-link" data-path="${fileHref}">Link kopieren</button>
|
|
||||||
<form method="post" action="${baseUrl(`/files/${item.id}/delete`)}">
|
<form method="post" action="${baseUrl(`/files/${item.id}/delete`)}">
|
||||||
${csrfField(res.locals.csrfToken)}
|
${csrfField(res.locals.csrfToken)}
|
||||||
<button type="submit" class="secondary">Löschen</button>
|
<button type="submit" class="secondary">Löschen</button>
|
||||||
@@ -1624,6 +1623,9 @@ app.get(`${basePath}/dashboard`, requireAuthPage, async (req, res) => {
|
|||||||
<button type="submit">Verlängern</button>
|
<button type="submit">Verlängern</button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
<button type="button" class="secondary copy-link" data-path="${fileHref}">Link kopieren</button>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
}).join('');
|
}).join('');
|
||||||
@@ -1668,6 +1670,7 @@ app.get(`${basePath}/dashboard`, requireAuthPage, async (req, res) => {
|
|||||||
<th>Größe</th>
|
<th>Größe</th>
|
||||||
<th>Läuft ab</th>
|
<th>Läuft ab</th>
|
||||||
<th>Aktionen</th>
|
<th>Aktionen</th>
|
||||||
|
<th>Link</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -1830,12 +1833,6 @@ app.post(`${basePath}/files/:id/extend`, requireAuthPage, async (req, res) => {
|
|||||||
res.redirect(baseUrl('/dashboard'));
|
res.redirect(baseUrl('/dashboard'));
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use((req, res) => {
|
|
||||||
res.status(404).send(renderPage('Nicht gefunden', '<p class="card">Seite nicht gefunden.</p>'));
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add endpoint to serve files with correct headers
|
|
||||||
// NOTE: This must be mounted at root level or matching the path prefix handled by Traefik
|
|
||||||
app.get('/_share/:filename', async (req, res) => {
|
app.get('/_share/:filename', async (req, res) => {
|
||||||
const filename = req.params.filename;
|
const filename = req.params.filename;
|
||||||
// Security check: ensure no path traversal
|
// Security check: ensure no path traversal
|
||||||
@@ -1860,6 +1857,10 @@ app.get('/_share/:filename', async (req, res) => {
|
|||||||
res.download(row.stored_path, row.original_name);
|
res.download(row.stored_path, row.original_name);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.use((req, res) => {
|
||||||
|
res.status(404).send(renderPage('Nicht gefunden', '<p class="card">Seite nicht gefunden.</p>'));
|
||||||
|
});
|
||||||
|
|
||||||
const server = app.listen(port, () => {
|
const server = app.listen(port, () => {
|
||||||
console.log(`Express server listening on ${port} with base path ${basePath}`);
|
console.log(`Express server listening on ${port} with base path ${basePath}`);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user