mirror of
https://github.com/daeuniverse/dae.git
synced 2024-12-23 01:34:42 +07:00
chore: close file descriptor & remove duplicated error handle (#303)
This commit is contained in:
parent
0010ccb675
commit
a333079686
@ -106,6 +106,7 @@ func ResolveFile(u *url.URL, configDir string) (b []byte, err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
defer f.Close()
|
||||||
// Check file access.
|
// Check file access.
|
||||||
fi, err := f.Stat()
|
fi, err := f.Stat()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -167,9 +168,6 @@ func ResolveSubscription(log *logrus.Logger, client *http.Client, configDir stri
|
|||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
req.Header.Set("User-Agent", fmt.Sprintf("dae/%v (like v2rayA/1.0 WebRequestHelper) (like v2rayN/1.0 WebRequestHelper)", config.Version))
|
req.Header.Set("User-Agent", fmt.Sprintf("dae/%v (like v2rayA/1.0 WebRequestHelper) (like v2rayN/1.0 WebRequestHelper)", config.Version))
|
||||||
if err != nil {
|
|
||||||
return "", nil, err
|
|
||||||
}
|
|
||||||
resp, err = client.Do(req)
|
resp, err = client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user