Skip to content

Commit

Permalink
chore: close file descriptor & remove duplicated error handle (daeuni…
Browse files Browse the repository at this point in the history
  • Loading branch information
douglarek authored Aug 28, 2023
1 parent 0010ccb commit a333079
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions common/subscription/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func ResolveFile(u *url.URL, configDir string) (b []byte, err error) {
if err != nil {
return nil, err
}
defer f.Close()
// Check file access.
fi, err := f.Stat()
if err != nil {
Expand Down Expand Up @@ -167,9 +168,6 @@ func ResolveSubscription(log *logrus.Logger, client *http.Client, configDir stri
return "", nil, err
}
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)
if err != nil {
return "", nil, err
Expand Down

0 comments on commit a333079

Please sign in to comment.