From cc05584245942f31228eb053ee2aa1fc03b70192 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Mon, 30 Mar 2026 17:30:06 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=95=9C=E5=83=8F=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E4=B8=8D=E5=86=8D=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/commit_logs_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/commit_logs_controller.rb b/app/controllers/commit_logs_controller.rb index fbdea6d10..916919620 100644 --- a/app/controllers/commit_logs_controller.rb +++ b/app/controllers/commit_logs_controller.rb @@ -16,6 +16,7 @@ class CommitLogsController < ApplicationController project = Project.where(identifier: repository_name).where(user_id: owner&.id)&.first project = Project.where(identifier: repository_name).where(gpid: repository_id)&.first if project.blank? project.update_column(:updated_on, Time.now) if project.present? + render_ok if project.project_type == 'mirror' params[:commits].each do |commit| commit_id = commit[:id] message = commit[:message] @@ -36,6 +37,7 @@ class CommitLogsController < ApplicationController solve_issue_content = message.to_s.scan(/\b(Fix|Fixes|Fixed|Fixing|fix|fixes|fixed|fixing|Resolve|Resolves|Resolved|Resolving|resolve|resolves|resolved|resolving|Implement|Implements|Implemented|Implementing|implement|implements|implemented|implementing)\s*(#\d+(,\s*#\d+)*)?\b/) ChangeIssueStatusByMessageJob.perform_later(commit_id, project, commit_user, solve_issue_content[0][1], 3) if solve_issue_content[0].present? && solve_issue_content[0][1].present? end + render_ok end end From 4fe2dc6b28c1df9d500c5ad8e828dae641298e5c Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 9 Apr 2026 15:34:31 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E4=BB=93=E5=BA=93=E5=AF=86=E7=A0=81=E4=B8=BA=E4=B8=A5?= =?UTF-8?q?=E6=A0=BCbase64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/repositories/migrate_service.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/services/repositories/migrate_service.rb b/app/services/repositories/migrate_service.rb index 4c3d4668d..89145e33f 100644 --- a/app/services/repositories/migrate_service.rb +++ b/app/services/repositories/migrate_service.rb @@ -32,7 +32,7 @@ class Repositories::MigrateService < ApplicationService private: params[:hidden], mirror: wrapper_mirror || false, auth_username: params[:login], - auth_password: Base64.decode64(params[:password] || ""), + auth_password: base64_decode_password, auth_token: params[:auth_token], service: params[:service] || 'git', } @@ -41,4 +41,10 @@ class Repositories::MigrateService < ApplicationService def wrapper_mirror ActiveModel::Type::Boolean.new.cast(params[:is_mirror]) end + + def base64_decode_password + Base64.strict_decode64(params[:password] || "") + rescue + params[:password] + end end From 1f41779e9bf69c202658c41a56c1fddaef78ef4e Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 9 Apr 2026 15:51:15 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E6=A0=87=E7=AD=BE=E6=90=9C=E7=B4=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/project_topics_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/project_topics_controller.rb b/app/controllers/api/v1/project_topics_controller.rb index 46ae4cee0..daa0a5a66 100644 --- a/app/controllers/api/v1/project_topics_controller.rb +++ b/app/controllers/api/v1/project_topics_controller.rb @@ -2,7 +2,7 @@ class Api::V1::ProjectTopicsController < Api::V1::BaseController def index @project_topics = ProjectTopic - @project_topics = @project_topics.ransack(name_cont: params[:keyword]) if params[:keyword].present? + @project_topics = @project_topics.ransack(name_cont: params[:keyword]).result if params[:keyword].present? # @project_topics = @project_topics.includes(:projects) @project_topics = kaminary_select_paginate(@project_topics) end From 328f3a0b7292d18357ad881b622a9d2fc7499493 Mon Sep 17 00:00:00 2001 From: yystopf Date: Fri, 10 Apr 2026 16:50:54 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E6=96=87=E4=BB=B6=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=88=9B=E5=BB=BA=E6=96=87=E4=BB=B6=E6=8E=A5=E5=8F=A3=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/repositories_controller.rb | 1 + .../gitea/create_file_interactor.rb | 2 ++ .../gitea/delete_file_interactor.rb | 4 +++- .../gitea/update_file_interactor.rb | 20 ++++++++++++++++--- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index ad7acc986..38d810c49 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -368,6 +368,7 @@ class RepositoriesController < ApplicationController def content_params { + base64_filepath: params[:base64_filepath], filepath: params[:filepath], branch: params[:branch], new_branch: params[:new_branch], diff --git a/app/interactors/gitea/create_file_interactor.rb b/app/interactors/gitea/create_file_interactor.rb index 70e2f6e81..f3db28417 100644 --- a/app/interactors/gitea/create_file_interactor.rb +++ b/app/interactors/gitea/create_file_interactor.rb @@ -56,6 +56,8 @@ module Gitea else @params[:filepath] end + rescue + @params[:filepath] end def valid_params diff --git a/app/interactors/gitea/delete_file_interactor.rb b/app/interactors/gitea/delete_file_interactor.rb index f94b8a205..84cd92ff6 100644 --- a/app/interactors/gitea/delete_file_interactor.rb +++ b/app/interactors/gitea/delete_file_interactor.rb @@ -51,10 +51,12 @@ module Gitea def file_path if @params[:base64_filepath].present? - Base64.decode64(params[:base64_filepath]) + Base64.strict_decode64(params[:base64_filepath]) else @params[:filepath] end + rescue + @params[:filepath] end def valid_params diff --git a/app/interactors/gitea/update_file_interactor.rb b/app/interactors/gitea/update_file_interactor.rb index 1b729e2c8..65dde34f5 100644 --- a/app/interactors/gitea/update_file_interactor.rb +++ b/app/interactors/gitea/update_file_interactor.rb @@ -50,18 +50,32 @@ module Gitea def file_path if @params[:base64_filepath].present? - Base64.decode64(params[:base64_filepath]) + Base64.strict_decode64(params[:base64_filepath]) else @params[:filepath] end + rescue + @params[:filepath] end def from_file_path if @params[:base64_from_path].present? - Base64.decode64(params[:base64_from_path]) + Base64.strict_decode64(params[:base64_from_path]) else @params[:from_path] end + rescue + @params[:from_path] + end + + def base64_content + if @params[:base64_content].present? + Base64.strict_decode64(params[:base64_content]) + else + @params[:content] + end + rescue + @params[:content] end def valid_params @@ -80,7 +94,7 @@ module Gitea new_branch: @params[:new_branch], from_path: from_file_path, message: @params[:message], - content: Base64.encode64(@params[:content]) + content: base64_content ).compact end end From 17bd3034bb1ecf45c3d3e1e1859d0947511d6380 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 13 Apr 2026 14:47:09 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=96=87=E4=BB=B6=E4=BD=BF=E7=94=A8base64encode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/interactors/gitea/update_file_interactor.rb | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/app/interactors/gitea/update_file_interactor.rb b/app/interactors/gitea/update_file_interactor.rb index 65dde34f5..321f00ade 100644 --- a/app/interactors/gitea/update_file_interactor.rb +++ b/app/interactors/gitea/update_file_interactor.rb @@ -68,16 +68,6 @@ module Gitea @params[:from_path] end - def base64_content - if @params[:base64_content].present? - Base64.strict_decode64(params[:base64_content]) - else - @params[:content] - end - rescue - @params[:content] - end - def valid_params { filepath: file_path, @@ -94,7 +84,7 @@ module Gitea new_branch: @params[:new_branch], from_path: from_file_path, message: @params[:message], - content: base64_content + content: Base64.encode64(@params[:content]) ).compact end end From 3ae73ebf06e8d033b99dc1e0f9be9103bc8cd2af Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 13 Apr 2026 14:58:06 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=96=87=E4=BB=B6=E9=9C=80=E9=AA=8C=E8=AF=81=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=86=85=E5=AE=B9=E6=98=AF=E5=90=A6=E4=B8=BAbase64?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/gitea/repository/entries/create_service.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/services/gitea/repository/entries/create_service.rb b/app/services/gitea/repository/entries/create_service.rb index 406106744..6a80e1d62 100644 --- a/app/services/gitea/repository/entries/create_service.rb +++ b/app/services/gitea/repository/entries/create_service.rb @@ -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 From 13e02594f719634911cf6e38c3a94401232eaad4 Mon Sep 17 00:00:00 2001 From: yystopf Date: Wed, 22 Apr 2026 16:18:56 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E8=AF=B7=E6=B1=82files=5Fcount=E4=B8=BA0=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/pull_requests/create_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/pull_requests/create_service.rb b/app/services/pull_requests/create_service.rb index 31e6b1fd8..1723c7f29 100644 --- a/app/services/pull_requests/create_service.rb +++ b/app/services/pull_requests/create_service.rb @@ -187,7 +187,7 @@ class PullRequests::CreateService < ApplicationService def compare_head_base! head = pull_request.is_original && @params[:merge_user_login] ? "#{@params[:merge_user_login]}/#{@params[:merge_project_identifier]}:#{@params[:head]}" : @params[:head] compare_result = Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, Addressable::URI.escape(@params[:base]), Addressable::URI.escape(head), @current_user.gitea_token) - raise '分支内容相同,无需创建合并请求' if compare_result["Commits"].blank? && compare_result["Diff"].blank? + raise '分支内容相同,无需创建合并请求' if compare_result["Commits"].blank? && compare_result["Diff"].blank? && compare_result["FilesCount"].zero? end def is_original