lint: warn on basic auth and non-handled err in gridfs avatar

This commit is contained in:
Umputun
2018-09-07 14:48:58 -05:00
parent 96e4116d60
commit 3ab05490b4
2 changed files with 5 additions and 3 deletions
+2 -2
View File
@@ -58,7 +58,7 @@ func (a *Authenticator) Auth(reqAuth bool) func(http.Handler) http.Handler {
}
// use dev user basic auth if enabled
if a.basicDevUser(w, r) {
if a.basicDevUser(r) {
r = rest.SetUserInfo(r, devUser)
h.ServeHTTP(w, r)
return
@@ -166,7 +166,7 @@ func (a *Authenticator) AdminOnly(next http.Handler) http.Handler {
return http.HandlerFunc(fn)
}
func (a *Authenticator) basicDevUser(w http.ResponseWriter, r *http.Request) bool {
func (a *Authenticator) basicDevUser(r *http.Request) bool {
if a.DevPasswd == "" {
return false
+3 -1
View File
@@ -89,7 +89,9 @@ func (gf *GridFS) Remove(avatar string) error {
if e != nil {
return errors.Wrapf(e, "can't get avatar %s", avatar)
}
_ = fh.Close()
if e = fh.Close(); e != nil {
log.Printf("[WARN] can't close avatar %s, %s", avatar, e)
}
return dbase.GridFS("fs").Remove(avatar)
})
}