mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-05 21:14:26 -04:00
Fix: Do not allow white space around IP
Feat: Trim input on submit Test: Add test for whitespace regex match
This commit is contained in:
parent
ce82ad1c12
commit
95c934e08b
3 changed files with 20 additions and 4 deletions
|
@ -9,7 +9,11 @@ describe("Test util-frontend.js", () => {
|
|||
expect(regex.test("www.test.com")).to.be.true;
|
||||
expect(regex.test("127.0.0.1")).to.be.true;
|
||||
expect(regex.test("192.168.1.156")).to.be.true;
|
||||
|
||||
expect(regex.test(" 192.168.1.145")).to.be.false;
|
||||
expect(regex.test("192.168.1.145 ")).to.be.false;
|
||||
expect(regex.test(" fe80::3282:3ff:ae28:592")).to.be.false;
|
||||
expect(regex.test("fe80::3282:3ff:ae28:592 ")).to.be.false;
|
||||
|
||||
["mqtt", "mqtts", "ws", "wss"].forEach(schema => {
|
||||
expect(regex.test(`${schema}://www.test.com`)).to.be.false;
|
||||
expect(regex.test(`${schema}://127.0.0.1`)).to.be.false;
|
||||
|
@ -23,11 +27,15 @@ describe("Test util-frontend.js", () => {
|
|||
expect(regex.test("www.test.com")).to.be.true;
|
||||
expect(regex.test("127.0.0.1")).to.be.true;
|
||||
expect(regex.test("192.168.1.156")).to.be.true;
|
||||
|
||||
expect(regex.test(" 192.168.1.145")).to.be.false;
|
||||
expect(regex.test("192.168.1.145 ")).to.be.false;
|
||||
expect(regex.test(" fe80::3282:3ff:ae28:592")).to.be.false;
|
||||
expect(regex.test("fe80::3282:3ff:ae28:592 ")).to.be.false;
|
||||
|
||||
["mqtt", "mqtts", "ws", "wss"].forEach(schema => {
|
||||
expect(regex.test(`${schema}://www.test.com`)).to.be.true;
|
||||
expect(regex.test(`${schema}://127.0.0.1`)).to.be.true;
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue