From c6e77ac7eeb2026e9a852d2fea2c69db760c2c82 Mon Sep 17 00:00:00 2001 From: yystopf Date: Tue, 29 Nov 2022 17:02:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=9C=AA=E5=88=9B=E5=BB=BA=E6=96=B0=E5=88=86?= =?UTF-8?q?=E6=94=AF=E6=97=B6=E4=B8=BA=E7=A9=BA=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/gitea/repository/entries/create_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/gitea/repository/entries/create_service.rb b/app/services/gitea/repository/entries/create_service.rb index 1bdc7246d..14b373335 100644 --- a/app/services/gitea/repository/entries/create_service.rb +++ b/app/services/gitea/repository/entries/create_service.rb @@ -56,7 +56,7 @@ class Gitea::Repository::Entries::CreateService < Gitea::ClientService when 403 then error("你没有权限操作!") when 404 then error("你操作的链接不存在!") when 422 - if @body[:new_branch].include?('/') || @body[:new_branch].include?('\'') || @body[:new_branch].include?('^') || @body[:new_branch].include?('*') + if @body[:new_branch].present? && (@body[:new_branch].include?('/') || @body[:new_branch].include?('\'') || @body[:new_branch].include?('^') || @body[:new_branch].include?('*')) error("不合法的分支名称!") else error("#{filepath}文件已存在,不能重复创建!")