From 53b66f6145c6b4bf6fd7b964e5070ef5351f6428 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 30 Aug 2023 16:34:23 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E6=96=87=E4=BB=B6=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=88=A0=E9=99=A4=E6=93=8D=E4=BD=9C=E6=97=A0?= =?UTF-8?q?=E6=9D=83=E9=99=90=E6=8F=90=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/interactors/gitea/delete_file_interactor.rb | 3 +++ app/interactors/gitea/update_file_interactor.rb | 3 +++ app/services/gitea/repository/entries/create_service.rb | 6 ++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/interactors/gitea/delete_file_interactor.rb b/app/interactors/gitea/delete_file_interactor.rb index 103df6cd4..03ddf4230 100644 --- a/app/interactors/gitea/delete_file_interactor.rb +++ b/app/interactors/gitea/delete_file_interactor.rb @@ -42,6 +42,9 @@ module Gitea def render_result(response) if response.status == 200 @result = JSON.parse(response.body) + else + Rails.logger.error("Gitea::Repository::Entries::DeleteService error[#{response.status}]======#{response.body}") + @error = "删除失败,请确认该分支是否是保护分支。" end end diff --git a/app/interactors/gitea/update_file_interactor.rb b/app/interactors/gitea/update_file_interactor.rb index 38cfd98a8..1b729e2c8 100644 --- a/app/interactors/gitea/update_file_interactor.rb +++ b/app/interactors/gitea/update_file_interactor.rb @@ -42,6 +42,9 @@ module Gitea def render_result(response) if response.status == 200 @result = JSON.parse(response.body) + else + Rails.logger.error("Gitea::Repository::Entries::UpdateService error[#{response.status}]======#{response.body}") + @error = "更新失败,请确认该分支是否是保护分支。" end end diff --git a/app/services/gitea/repository/entries/create_service.rb b/app/services/gitea/repository/entries/create_service.rb index 14b373335..ac27b3afb 100644 --- a/app/services/gitea/repository/entries/create_service.rb +++ b/app/services/gitea/repository/entries/create_service.rb @@ -53,7 +53,7 @@ class Gitea::Repository::Entries::CreateService < Gitea::ClientService def status_payload(status, body) case status when 201 then success(json_parse!(body)) - when 403 then error("你没有权限操作!") + when 403 then error("你没有权限操作,请确认该分支是否是保护分支。") when 404 then error("你操作的链接不存在!") when 422 if @body[:new_branch].present? && (@body[:new_branch].include?('/') || @body[:new_branch].include?('\'') || @body[:new_branch].include?('^') || @body[:new_branch].include?('*')) @@ -61,7 +61,9 @@ class Gitea::Repository::Entries::CreateService < Gitea::ClientService else error("#{filepath}文件已存在,不能重复创建!") end - else error("系统错误!") + else + Rails.logger.error("Gitea api url==#{url},status:#{status},body=#{body}") + error("系统错误!") end end end