修复:创建文件需验证文件内容是否为base64

This commit is contained in:
yystopf 2026-04-13 14:58:06 +08:00
parent 17bd3034bb
commit 3ae73ebf06
1 changed files with 3 additions and 1 deletions

View File

@ -61,7 +61,9 @@ class Gitea::Repository::Entries::CreateService < Gitea::ClientService
else
if json_parse!(body)["message"].present? && json_parse!(body)["message"].starts_with?("branch already exists")
error("#{@body[:new_branch]}分支已存在!")
else
elsif json_parse!(body)["message"].present? && json_parse!(body)["message"].starts_with?("illegal base64 data at input byte 4")
error("文件内容必须是base64编码的!")
else
error("#{filepath}文件已存在,不能重复创建!")
end
end