use custom middleware to prevent favicon requests

pull/19/head
tycrek 3 years ago
parent c4b0e7cb1e
commit d0bf63b077
No known key found for this signature in database
GPG Key ID: 25D74F3943625263

@ -79,6 +79,9 @@ function preStartup() {
function startup() { function startup() {
app.use(useragent.express()); app.use(useragent.express());
// Don't process favicon requests
app.use((req, res, next) => req.url.includes('favicon.ico') ? res.sendStatus(204) : next());
// Upload file // Upload file
app.post('/', upload.single('file'), (req, res) => { app.post('/', upload.single('file'), (req, res) => {
// Prevent uploads from unauthorized clients // Prevent uploads from unauthorized clients
@ -155,9 +158,6 @@ function startup() {
// View file // View file
app.get('/:resourceId', (req, res) => { app.get('/:resourceId', (req, res) => {
// Don't process favicon requests
if (req.url.includes('favicon.ico')) return;
// Parse the resource ID // Parse the resource ID
let resourceId = req.params.resourceId.split('.')[0]; let resourceId = req.params.resourceId.split('.')[0];

Loading…
Cancel
Save