Skip to content

Commit 8f0b428

Browse files
PET-445: fix create user 500 problem
Signed-off-by: bryan <[email protected]>
1 parent c4ac0c6 commit 8f0b428

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

web/src/apis/user.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ func (v *UserAPI) Create(c *gin.Context) {
187187
ErrorResponse(c, http.StatusInternalServerError, "Failed to create user", err)
188188
return
189189
}
190-
orgUUID := payload.Org.ID // optional, if not provided, will generate a new one
190+
orgUUID := ""
191+
if payload.Org != nil && payload.Org.ID != "" {
192+
orgUUID = payload.Org.ID // optional, if not provided, will generate a new one
193+
}
191194
if orgUUID != "" && !utils.IsUUID(orgUUID) {
192195
logger.Errorf("Invalid org uuid: %s", orgUUID)
193196
ErrorResponse(c, http.StatusBadRequest, "Invalid org uuid", nil)

0 commit comments

Comments
 (0)