From a55be58c012ee3c4b85a5aa6f0456944e12f661c Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Sat, 8 Feb 2020 16:21:52 +0800 Subject: [PATCH] Fix: provider should fallback to read remote when local file invalid --- adapters/provider/provider.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/adapters/provider/provider.go b/adapters/provider/provider.go index 139ce703..fef148a4 100644 --- a/adapters/provider/provider.go +++ b/adapters/provider/provider.go @@ -128,7 +128,11 @@ func (pp *ProxySetProvider) Initial() error { proxies, err := pp.parse(buf) if err != nil { - return err + // 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 {