Compare commits

...

3 Commits

Author SHA1 Message Date
Oleg Lobanov
49dbacdccd chore(release): 2.22.3 2022-07-05 16:58:52 +02:00
Oleg Lobanov
d94acdd89a fix: use correct field name in user put api (#2026) 2022-07-05 16:55:31 +02:00
源文雨
06d9c03e92 chore(deps): move golang.org/x/text to direct (#2021) 2022-07-05 16:27:33 +02:00
4 changed files with 15 additions and 3 deletions

View File

@@ -2,6 +2,13 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [2.22.3](https://github.com/filebrowser/filebrowser/compare/v2.22.2...v2.22.3) (2022-07-05)
### Bug Fixes
* use correct field name in user put api ([#2026](https://github.com/filebrowser/filebrowser/issues/2026)) ([d94acdd](https://github.com/filebrowser/filebrowser/commit/d94acdd89a0069fe87107024fd332a0d59a112fc))
### [2.22.2](https://github.com/filebrowser/filebrowser/compare/v2.22.1...v2.22.2) (2022-07-01) ### [2.22.2](https://github.com/filebrowser/filebrowser/compare/v2.22.1...v2.22.2) (2022-07-01)

2
go.mod
View File

@@ -25,6 +25,7 @@ require (
go.etcd.io/bbolt v1.3.6 go.etcd.io/bbolt v1.3.6
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f
golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9 golang.org/x/image v0.0.0-20220413100746-70e8d0d3baa9
golang.org/x/text v0.3.7
gopkg.in/natefinch/lumberjack.v2 v2.0.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
) )
@@ -66,7 +67,6 @@ require (
github.com/yusufpapurcu/wmi v1.2.2 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/square/go-jose.v2 v2.2.2 // indirect gopkg.in/square/go-jose.v2 v2.2.2 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect

View File

@@ -177,7 +177,7 @@ var userPutHandler = withSelfOrAdmin(func(w http.ResponseWriter, r *http.Request
} }
for k, v := range req.Which { for k, v := range req.Which {
v = cases.Title(language.English).String(v) v = cases.Title(language.English, cases.NoLower).String(v)
req.Which[k] = v req.Which[k] = v
if v == "Password" { if v == "Password" {

View File

@@ -1,6 +1,7 @@
package bolt package bolt
import ( import (
"fmt"
"reflect" "reflect"
"github.com/asdine/storm/v3" "github.com/asdine/storm/v3"
@@ -58,7 +59,11 @@ func (st usersBackend) Update(user *users.User, fields ...string) error {
} }
for _, field := range fields { for _, field := range fields {
val := reflect.ValueOf(user).Elem().FieldByName(field).Interface() userField := reflect.ValueOf(user).Elem().FieldByName(field)
if !userField.IsValid() {
return fmt.Errorf("invalid field: %s", field)
}
val := userField.Interface()
if err := st.db.UpdateField(user, field, val); err != nil { if err := st.db.UpdateField(user, field, val); err != nil {
return err return err
} }