fix(backend): harden write registrar boundaries
This commit is contained in:
@@ -93,15 +93,18 @@ func (h *Handler) update(c *gin.Context) {
|
||||
httpx.Error(c, http.StatusBadRequest, "invalid_request", "请求参数无效")
|
||||
return
|
||||
}
|
||||
nextProjectIdentity := ""
|
||||
if strings.TrimSpace(input.NextProjectID) != "" {
|
||||
if _, ok := parseIdentity(input.NextProjectID); !ok {
|
||||
var valid bool
|
||||
nextProjectIdentity, valid = parseIdentity(input.NextProjectID)
|
||||
if !valid {
|
||||
httpx.Error(c, http.StatusBadRequest, "invalid_identity", "nextProjectId 必须是 UUIDv7")
|
||||
return
|
||||
}
|
||||
}
|
||||
task, err := h.service.Update(userID, projectIdentity, taskIdentity, UpdateTaskInput{
|
||||
Title: input.Title, Description: input.Description, Status: input.Status, Completed: input.Completed,
|
||||
NextProjectIdentity: input.NextProjectID, Tag: input.Tag,
|
||||
NextProjectIdentity: nextProjectIdentity, Tag: input.Tag,
|
||||
})
|
||||
if err != nil {
|
||||
writeTaskError(c, err)
|
||||
|
||||
Reference in New Issue
Block a user