1
0
Fork 0

Fix entry comment processing.

This commit is contained in:
Captain ALM 2023-12-05 22:32:13 +00:00
parent ac71484962
commit b701669648
Signed by untrusted user: alfred
GPG Key ID: 4E4ADD02609997B1
1 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import "strings"
func NewHostsEntry(lineIn string) Entry {
trLineIn := strings.ReplaceAll(strings.Trim(lineIn, "\r\n"), " ", " ")
lineSplt := strings.Split(trLineIn, " ")
if len(lineSplt) == 1 && strings.HasPrefix(strings.TrimPrefix(" ", trLineIn), "#") {
if strings.HasPrefix(strings.TrimPrefix(" ", trLineIn), "#") {
return Entry{
IPAddress: "",
Domains: nil,
@ -17,7 +17,7 @@ func NewHostsEntry(lineIn string) Entry {
if lineSplt[i] == "" {
continue
}
if strings.HasPrefix(lineSplt[i], "#") {
if strings.HasPrefix(strings.TrimPrefix(" ", lineSplt[i]), "#") {
break
}
theDomains = append(theDomains, lineSplt[i])