Browse Source

fix: unvalid branch name return error

tags/v4.0.0^2
yystopf 4 years ago
parent
commit
dcf44a78f0
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      app/services/gitea/repository/entries/create_service.rb

+ 6
- 1
app/services/gitea/repository/entries/create_service.rb View File

@@ -55,7 +55,12 @@ class Gitea::Repository::Entries::CreateService < Gitea::ClientService
when 201 then success(json_parse!(body))
when 403 then error("你没有权限操作!")
when 404 then error("你操作的链接不存在!")
when 422 then error("#{filepath}文件已存在,不能重复创建!")
when 422
if @body[:new_branch].include?('') || @body[:new_branch].include?('\'') || @body[:new_branch].include?('^') || @body[:new_branch].include?('*')
error("不合法的分支名称!")
else
error("#{filepath}文件已存在,不能重复创建!")
end
else error("系统错误!")
end
end


Loading…
Cancel
Save