Fix entry comment processing.
This commit is contained in:
parent
ac71484962
commit
b701669648
@ -5,7 +5,7 @@ import "strings"
|
|||||||
func NewHostsEntry(lineIn string) Entry {
|
func NewHostsEntry(lineIn string) Entry {
|
||||||
trLineIn := strings.ReplaceAll(strings.Trim(lineIn, "\r\n"), " ", " ")
|
trLineIn := strings.ReplaceAll(strings.Trim(lineIn, "\r\n"), " ", " ")
|
||||||
lineSplt := strings.Split(trLineIn, " ")
|
lineSplt := strings.Split(trLineIn, " ")
|
||||||
if len(lineSplt) == 1 && strings.HasPrefix(strings.TrimPrefix(" ", trLineIn), "#") {
|
if strings.HasPrefix(strings.TrimPrefix(" ", trLineIn), "#") {
|
||||||
return Entry{
|
return Entry{
|
||||||
IPAddress: "",
|
IPAddress: "",
|
||||||
Domains: nil,
|
Domains: nil,
|
||||||
@ -17,7 +17,7 @@ func NewHostsEntry(lineIn string) Entry {
|
|||||||
if lineSplt[i] == "" {
|
if lineSplt[i] == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(lineSplt[i], "#") {
|
if strings.HasPrefix(strings.TrimPrefix(" ", lineSplt[i]), "#") {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
theDomains = append(theDomains, lineSplt[i])
|
theDomains = append(theDomains, lineSplt[i])
|
||||||
|
Loading…
Reference in New Issue
Block a user