refactor: cleanup package names (#5605)

This commit is contained in:
Henrique Dias 2025-12-06 10:52:11 +01:00 committed by GitHub
parent a6934e40ff
commit f029c3005e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 78 additions and 78 deletions

View file

@ -1,4 +1,4 @@
package http
package fbhttp
import (
"encoding/json"
@ -12,7 +12,7 @@ import (
"golang.org/x/text/cases"
"golang.org/x/text/language"
fbErrors "github.com/filebrowser/filebrowser/v2/errors"
fberrors "github.com/filebrowser/filebrowser/v2/errors"
"github.com/filebrowser/filebrowser/v2/users"
)
@ -36,7 +36,7 @@ func getUserID(r *http.Request) (uint, error) {
func getUser(_ http.ResponseWriter, r *http.Request) (*modifyUserRequest, error) {
if r.Body == nil {
return nil, fbErrors.ErrEmptyRequest
return nil, fberrors.ErrEmptyRequest
}
req := &modifyUserRequest{}
@ -46,7 +46,7 @@ func getUser(_ http.ResponseWriter, r *http.Request) (*modifyUserRequest, error)
}
if req.What != "user" {
return nil, fbErrors.ErrInvalidDataType
return nil, fberrors.ErrInvalidDataType
}
return req, nil
@ -87,7 +87,7 @@ var usersGetHandler = withAdmin(func(w http.ResponseWriter, r *http.Request, d *
var userGetHandler = withSelfOrAdmin(func(w http.ResponseWriter, r *http.Request, d *data) (int, error) {
u, err := d.store.Users.Get(d.server.Root, d.raw.(uint))
if errors.Is(err, fbErrors.ErrNotExist) {
if errors.Is(err, fberrors.ErrNotExist) {
return http.StatusNotFound, err
}
@ -122,7 +122,7 @@ var userPostHandler = withAdmin(func(w http.ResponseWriter, r *http.Request, d *
}
if req.Data.Password == "" {
return http.StatusBadRequest, fbErrors.ErrEmptyPassword
return http.StatusBadRequest, fberrors.ErrEmptyPassword
}
req.Data.Password, err = users.ValidateAndHashPwd(req.Data.Password, d.settings.MinimumPasswordLength)