Skip to content

Commit 808f925

Browse files
cursoragentrgarcia
andcommitted
Fix user and group lookup error handling in SetFilePermissions
Co-authored-by: rgarcia2009 <rgarcia2009@gmail.com>
1 parent 5550c86 commit 808f925

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

server/cmd/api/api/fs.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,14 @@ func (s *ApiService) SetFilePermissions(ctx context.Context, req oapi.SetFilePer
294294
gid := -1
295295
if req.Body.Owner != nil {
296296
if u, err := user.Lookup(*req.Body.Owner); err == nil {
297-
if id, _ := strconv.Atoi(u.Uid); id >= 0 {
297+
if id, err := strconv.Atoi(u.Uid); err == nil && id >= 0 {
298298
uid = id
299299
}
300300
}
301301
}
302302
if req.Body.Group != nil {
303303
if g, err := user.LookupGroup(*req.Body.Group); err == nil {
304-
if id, _ := strconv.Atoi(g.Gid); id >= 0 {
304+
if id, err := strconv.Atoi(g.Gid); err == nil && id >= 0 {
305305
gid = id
306306
}
307307
}

0 commit comments

Comments
 (0)