fix: accept bare Pi-hole IPv4 addresses
This commit is contained in:
1 parent
42fa6efc84
commit
2082b68794
5 files changed
+15
-7
No files matched your search
@@ -101,6 +101,10 @@ func TestNewValidatesAndNormalizesPiHoleURL(t *testing.T) {
|
||||
if err != nil || client.BaseURL() != "http://pihole.local/custom/api" {
|
||||
t.Fatalf("custom path not normalized: %q err=%v", client.BaseURL(), err)
|
||||
}
|
||||
client, err = New("10.0.20.100", false)
|
||||
if err != nil || client.BaseURL() != "http://10.0.20.100/api" {
|
||||
t.Fatalf("bare IPv4 address not normalized: %q err=%v", client.BaseURL(), err)
|
||||
}
|
||||
for _, invalid := range []string{"pi.hole", "ftp://pi.hole", "https://user:pass@pi.hole", "https://pi.hole?sid=secret"} {
|
||||
if _, err := New(invalid, false); err == nil {
|
||||
t.Errorf("invalid URL accepted: %s", invalid)
|
||||
|
||||
Reference in new issue
Block a user