Update server/notification-providers/pushdeer.js

More concise and reasonable regular expression fix

Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
DayShift 2025-01-26 01:15:39 +08:00 committed by GitHub
parent 2098d34c5b
commit 84d67a239b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,8 @@ class PushDeer extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
const serverUrl = notification.pushdeerServer || "https://api2.pushdeer.com";
const url = `${serverUrl.trim().replace(/(?<!\/)\/*$/, "")}/message/push`;
// capture group below is nessesary to prevent an ReDOS-attack
const url = `${serverUrl.trim().replace(/([^\/])\/+$/, "$1")}/message/push`;
let valid = msg != null && monitorJSON != null && heartbeatJSON != null;