Merge pull request #3054 from TechWilk/keyword-not-found-whitespace

Trim before truncating "keword not found" message
This commit is contained in:
Louis Lam 2023-05-13 18:36:04 +08:00 committed by GitHub
commit 8d24891b8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -400,7 +400,7 @@ class Monitor extends BeanModel {
bean.msg += ", keyword is found"; bean.msg += ", keyword is found";
bean.status = UP; bean.status = UP;
} else { } else {
data = data.replace(/<[^>]*>?|[\n\r]|\s+/gm, " "); data = data.replace(/<[^>]*>?|[\n\r]|\s+/gm, " ").trim();
if (data.length > 50) { if (data.length > 50) {
data = data.substring(0, 47) + "..."; data = data.substring(0, 47) + "...";
} }