Fix: provider should fallback to read remote when local file invalid

This commit is contained in:
Dreamacro 2020-02-08 16:21:52 +08:00
parent dcf97ff5b4
commit a55be58c01

View file

@ -127,9 +127,13 @@ func (pp *ProxySetProvider) Initial() error {
}
proxies, err := pp.parse(buf)
if err != nil {
// parse local file error, fallback to remote
buf, err = pp.vehicle.Read()
if err != nil {
return err
}
}
if err := ioutil.WriteFile(pp.vehicle.Path(), buf, fileMode); err != nil {
return err