forked from alfred/HostPersister
Fix entry comment processing.
This commit is contained in:
parent
ac71484962
commit
b701669648
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user