fix(core): Ignore missing user-agent on bot check (no-changelog) (#7153)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-09-12 19:57:25 +02:00 committed by GitHub
parent 6e5a4f6a58
commit 22edc03cab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -201,7 +201,7 @@ export abstract class AbstractServer {
const checkIfBot = isbot.spawn(['bot']);
this.app.use((req, res, next) => {
const userAgent = req.headers['user-agent'];
if (!userAgent || checkIfBot(userAgent)) {
if (userAgent && checkIfBot(userAgent)) {
Logger.info(`Blocked ${req.method} ${req.url} for "${userAgent}"`);
res.status(204).end();
} else next();