diff --git a/app/controllers/pull_requests_controller.rb b/app/controllers/pull_requests_controller.rb index 9cb6e5e23..284c894ba 100644 --- a/app/controllers/pull_requests_controller.rb +++ b/app/controllers/pull_requests_controller.rb @@ -89,6 +89,7 @@ class PullRequestsController < ApplicationController else ActiveRecord::Base.transaction do begin + return normal_status(-1, "title不能超过255个字符") if params[:title].length > 255 merge_params @issue&.issue_tags_relates&.destroy_all if params[:issue_tag_ids].blank? diff --git a/app/services/pull_requests/create_service.rb b/app/services/pull_requests/create_service.rb index cc7493ea8..eaf931f38 100644 --- a/app/services/pull_requests/create_service.rb +++ b/app/services/pull_requests/create_service.rb @@ -148,6 +148,7 @@ class PullRequests::CreateService < ApplicationService def validate! raise "title参数不能为空" if @params[:title].blank? + raise "title不能超过255个字符" if @params[:title].length > 255 raise "head参数不能为空" if @params[:head].blank? raise "base参数不能为空" if @params[:base].blank? raise "fork_project_id参数错误" if is_original && !@project.forked_projects.pluck(:id).include?(@params[:fork_project_id].to_i)