forked from alfred/HostPersister
Fix Entry.go wrong way round arguments.
This commit is contained in:
parent
b701669648
commit
cfbf667389
@ -4,7 +4,7 @@ This allows for hosts specified in a host formatted file to be synced to the act
|
||||
|
||||
The .env file is used to configure the hosts file to use a source (SOURCE_FILE) to be synced to the actual file (HOSTS_FILE).
|
||||
There is the ability to overwrite existing values as part of sync, so long as the domain is the only one defined on the line (HOSTS_OVERWRITE = 1).
|
||||
There is the ability to periodic sync with a specified interval (SYNC_TIME).
|
||||
There is the ability to periodic sync with a specified interval in milliseconds (SYNC_TIME).
|
||||
|
||||
Maintainer:
|
||||
[Captain ALM](https://code.mrmelon54.com/alfred)
|
||||
|
@ -5,7 +5,7 @@ import "strings"
|
||||
func NewHostsEntry(lineIn string) Entry {
|
||||
trLineIn := strings.ReplaceAll(strings.Trim(lineIn, "\r\n"), " ", " ")
|
||||
lineSplt := strings.Split(trLineIn, " ")
|
||||
if 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(strings.TrimPrefix(" ", lineSplt[i]), "#") {
|
||||
if strings.HasPrefix(lineSplt[i], "#") {
|
||||
break
|
||||
}
|
||||
theDomains = append(theDomains, lineSplt[i])
|
||||
|
Loading…
Reference in New Issue
Block a user