From d2ced0bc6cd067164f1c59cf42394ebdd6d56b5d Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 25 Apr 2023 18:01:45 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E5=A2=9E=E5=8A=A0sidekiq=E7=BA=BF?= =?UTF-8?q?=E7=A8=8B=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/users/openkylin_sign_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/api/v1/users/openkylin_sign_controller.rb b/app/controllers/api/v1/users/openkylin_sign_controller.rb index df36e7867..6c76c5b3e 100644 --- a/app/controllers/api/v1/users/openkylin_sign_controller.rb +++ b/app/controllers/api/v1/users/openkylin_sign_controller.rb @@ -9,6 +9,7 @@ class Api::V1::Users::OpenkylinSignController < Api::V1::BaseController def create @object_result = Api::V1::Users::OpenkylinSign::CreateService.call(@observe_user, create_params) + Rails.logger.info "OpenkylinSignController=====#{@object_result}" if @object_result return render_ok else From c90fc3d48734d92753abef008e93bb2912ce9663 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 26 Apr 2023 15:55:29 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E5=AE=B9=E9=94=99=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_contributor.json.jbuilder | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/repositories/_contributor.json.jbuilder b/app/views/repositories/_contributor.json.jbuilder index ea8a5ae30..5d1c093bd 100644 --- a/app/views/repositories/_contributor.json.jbuilder +++ b/app/views/repositories/_contributor.json.jbuilder @@ -3,7 +3,7 @@ if user.blank? json.contributions contributor["commits"] json.login nil json.type nil - json.name contributor["name"].downcase + json.name contributor["name"].to_s.downcase json.email contributor["email"] json.image_url User::Avatar.get_letter_avatar_url(contributor["name"]) json.contribution_perc User.new(login: contributor["name"], mail: contributor["email"]).simple_contribution_perc(project, contributor["contribution_perc"]) @@ -13,7 +13,7 @@ else json.login user["login"] json.email user["email"] json.type user["type"] - json.name user["name"].downcase + json.name user["name"].to_s.downcase json.image_url user["avatar_url"] db_user = User.find_by_id(user["id"]) json.contribution_perc db_user.simple_contribution_perc(project, contributor["contribution_perc"]) if db_user.present? From 9f4e201360a4fc52e0ea898aa0f5ab4429be858f Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 26 Apr 2023 16:03:06 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E5=AE=B9=E9=94=99=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_contributor.json.jbuilder | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/repositories/_contributor.json.jbuilder b/app/views/repositories/_contributor.json.jbuilder index 5d1c093bd..0c4ddfb51 100644 --- a/app/views/repositories/_contributor.json.jbuilder +++ b/app/views/repositories/_contributor.json.jbuilder @@ -1,11 +1,11 @@ -user = $redis_cache.hgetall("v2-owner-common:#{contributor["name"]}-#{contributor["email"]}") +user = $redis_cache.hgetall("v2-owner-common:#{contributor["name"] || contributor["login"]}-#{contributor["email"]}") if user.blank? json.contributions contributor["commits"] - json.login nil + json.login contributor["name"].to_s.downcase || contributor["login"].to_s.downcase json.type nil - json.name contributor["name"].to_s.downcase + json.name contributor["name"].to_s.downcase || contributor["login"].to_s.downcase json.email contributor["email"] - json.image_url User::Avatar.get_letter_avatar_url(contributor["name"]) + json.image_url User::Avatar.get_letter_avatar_url(contributor["name"] || contributor["login"]) json.contribution_perc User.new(login: contributor["name"], mail: contributor["email"]).simple_contribution_perc(project, contributor["contribution_perc"]) else json.contributions contributor["commits"] From 67760fd1a97b3913dca059db37e5bd2d1d8c1ae7 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 26 Apr 2023 16:07:40 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E8=80=85=E5=AE=B9?= =?UTF-8?q?=E9=94=99=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_contributor.json.jbuilder | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/repositories/_contributor.json.jbuilder b/app/views/repositories/_contributor.json.jbuilder index 0c4ddfb51..da2ae37dc 100644 --- a/app/views/repositories/_contributor.json.jbuilder +++ b/app/views/repositories/_contributor.json.jbuilder @@ -1,6 +1,6 @@ user = $redis_cache.hgetall("v2-owner-common:#{contributor["name"] || contributor["login"]}-#{contributor["email"]}") if user.blank? - json.contributions contributor["commits"] + json.contributions contributor["commits"] || contributor["contributions"] json.login contributor["name"].to_s.downcase || contributor["login"].to_s.downcase json.type nil json.name contributor["name"].to_s.downcase || contributor["login"].to_s.downcase @@ -8,12 +8,12 @@ if user.blank? json.image_url User::Avatar.get_letter_avatar_url(contributor["name"] || contributor["login"]) json.contribution_perc User.new(login: contributor["name"], mail: contributor["email"]).simple_contribution_perc(project, contributor["contribution_perc"]) else - json.contributions contributor["commits"] + json.contributions contributor["commits"] || contributor["contributions"] json.id user["id"] - json.login user["login"] + json.login user["login"] || contributor["name"].to_s.downcase || contributor["login"].to_s.downcase json.email user["email"] json.type user["type"] - json.name user["name"].to_s.downcase + json.name user["name"].to_s.downcase || contributor["name"].to_s.downcase || contributor["login"].to_s.downcase json.image_url user["avatar_url"] db_user = User.find_by_id(user["id"]) json.contribution_perc db_user.simple_contribution_perc(project, contributor["contribution_perc"]) if db_user.present? From 8b28c84a8e8154d31dcb467425316e7d3b6d6379 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 26 Apr 2023 16:08:22 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E8=80=85=E5=AE=B9?= =?UTF-8?q?=E9=94=99=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_contributor.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/repositories/_contributor.json.jbuilder b/app/views/repositories/_contributor.json.jbuilder index da2ae37dc..dddf04398 100644 --- a/app/views/repositories/_contributor.json.jbuilder +++ b/app/views/repositories/_contributor.json.jbuilder @@ -6,7 +6,7 @@ if user.blank? json.name contributor["name"].to_s.downcase || contributor["login"].to_s.downcase json.email contributor["email"] json.image_url User::Avatar.get_letter_avatar_url(contributor["name"] || contributor["login"]) - json.contribution_perc User.new(login: contributor["name"], mail: contributor["email"]).simple_contribution_perc(project, contributor["contribution_perc"]) + json.contribution_perc User.new(login: (contributor["name"] || contributor["login"]), mail: contributor["email"]).simple_contribution_perc(project, contributor["contribution_perc"]) else json.contributions contributor["commits"] || contributor["contributions"] json.id user["id"] From c4ae40ee5297f4dd84a37dfdf6ee5688470e0c74 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 26 Apr 2023 16:15:23 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E8=80=85=E5=AE=B9?= =?UTF-8?q?=E9=94=99=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_contributor.json.jbuilder | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/repositories/_contributor.json.jbuilder b/app/views/repositories/_contributor.json.jbuilder index dddf04398..001ddd8b1 100644 --- a/app/views/repositories/_contributor.json.jbuilder +++ b/app/views/repositories/_contributor.json.jbuilder @@ -1,19 +1,19 @@ user = $redis_cache.hgetall("v2-owner-common:#{contributor["name"] || contributor["login"]}-#{contributor["email"]}") if user.blank? json.contributions contributor["commits"] || contributor["contributions"] - json.login contributor["name"].to_s.downcase || contributor["login"].to_s.downcase + json.login (contributor["name"] || contributor["login"]).to_s.downcase json.type nil - json.name contributor["name"].to_s.downcase || contributor["login"].to_s.downcase + json.name (contributor["name"] || contributor["login"]).to_s.downcase json.email contributor["email"] json.image_url User::Avatar.get_letter_avatar_url(contributor["name"] || contributor["login"]) json.contribution_perc User.new(login: (contributor["name"] || contributor["login"]), mail: contributor["email"]).simple_contribution_perc(project, contributor["contribution_perc"]) else json.contributions contributor["commits"] || contributor["contributions"] json.id user["id"] - json.login user["login"] || contributor["name"].to_s.downcase || contributor["login"].to_s.downcase + json.login (user["login"] || contributor["name"] || contributor["login"]).to_s.downcase json.email user["email"] json.type user["type"] - json.name user["name"].to_s.downcase || contributor["name"].to_s.downcase || contributor["login"].to_s.downcase + json.name (user["name"] || contributor["name"] || contributor["login"]).to_s.downcase json.image_url user["avatar_url"] db_user = User.find_by_id(user["id"]) json.contribution_perc db_user.simple_contribution_perc(project, contributor["contribution_perc"]) if db_user.present? From 6b716855a90e427ac38449047832d59fd05a7036 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 26 Apr 2023 16:17:58 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E8=B4=A1=E7=8C=AE=E8=80=85=E5=AE=B9?= =?UTF-8?q?=E9=94=99=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/repositories/_contributor.json.jbuilder | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/repositories/_contributor.json.jbuilder b/app/views/repositories/_contributor.json.jbuilder index 001ddd8b1..b0547eba3 100644 --- a/app/views/repositories/_contributor.json.jbuilder +++ b/app/views/repositories/_contributor.json.jbuilder @@ -1,7 +1,7 @@ user = $redis_cache.hgetall("v2-owner-common:#{contributor["name"] || contributor["login"]}-#{contributor["email"]}") if user.blank? json.contributions contributor["commits"] || contributor["contributions"] - json.login (contributor["name"] || contributor["login"]).to_s.downcase + json.login nil json.type nil json.name (contributor["name"] || contributor["login"]).to_s.downcase json.email contributor["email"] @@ -10,7 +10,7 @@ if user.blank? else json.contributions contributor["commits"] || contributor["contributions"] json.id user["id"] - json.login (user["login"] || contributor["name"] || contributor["login"]).to_s.downcase + json.login user["login"] json.email user["email"] json.type user["type"] json.name (user["name"] || contributor["name"] || contributor["login"]).to_s.downcase From 1bfaa44af570b5829c4a398dd0b3b5fe05f6e1bd Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 27 Apr 2023 09:29:13 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E4=BB=93=E5=BA=93=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=9A=8F=E7=9D=80=E9=A1=B9=E7=9B=AE=E6=95=B0?= =?UTF-8?q?=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations/organizations_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/organizations/organizations_controller.rb b/app/controllers/organizations/organizations_controller.rb index 0abd8d1ca..c2e670f55 100644 --- a/app/controllers/organizations/organizations_controller.rb +++ b/app/controllers/organizations/organizations_controller.rb @@ -88,7 +88,7 @@ class Organizations::OrganizationsController < Organizations::BaseController projects = @organization.projects projects_count = @organization.projects.count - languages_hash = Rails.cache.fetch("query/organizations/languages/#{@organization.id}", :expires_in => 1.days) do + languages_hash = Rails.cache.fetch("query/organizations/languages/#{@organization.id}/#{projects_count}", :expires_in => 1.days) do total_languages(projects) end From 9630fbfec55a40ef06eddc2d0972bf5eb40e179a Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 27 Apr 2023 18:07:43 +0800 Subject: [PATCH 09/16] =?UTF-8?q?=E4=BB=93=E5=BA=93=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=9A=8F=E7=9D=80=E9=A1=B9=E7=9B=AE=E6=95=B0?= =?UTF-8?q?=E5=8F=98=E5=8C=96=EF=BC=8C=E8=AE=A1=E7=AE=97=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations/organizations_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/organizations/organizations_controller.rb b/app/controllers/organizations/organizations_controller.rb index c2e670f55..31300f1ea 100644 --- a/app/controllers/organizations/organizations_controller.rb +++ b/app/controllers/organizations/organizations_controller.rb @@ -94,9 +94,10 @@ class Organizations::OrganizationsController < Organizations::BaseController languages_hash = languages_hash.sort { |x, y| y[1] <=> x[1] } sort_hash = Hash[*languages_hash.flatten] + total_byte_size = sort_hash.values.sum # Rails.logger.info "languages_hash=============#{sort_hash}" sort_hash= sort_hash.transform_values { |v| - ActionController::Base.helpers.number_to_percentage((v / projects_count), precision: 1) + ActionController::Base.helpers.number_to_percentage((v / total_byte_size), precision: 1) }.select { |k, v| v != "0.0%" } render json: sort_hash end From e50d4bdf34c8a56ee95d1d6bec843bb24535e7b5 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 27 Apr 2023 18:10:35 +0800 Subject: [PATCH 10/16] =?UTF-8?q?=E4=BB=93=E5=BA=93=E8=AF=AD=E8=A8=80?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E9=9A=8F=E7=9D=80=E9=A1=B9=E7=9B=AE=E6=95=B0?= =?UTF-8?q?=E5=8F=98=E5=8C=96=EF=BC=8C=E8=AE=A1=E7=AE=97=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations/organizations_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/organizations/organizations_controller.rb b/app/controllers/organizations/organizations_controller.rb index 31300f1ea..3c4e64780 100644 --- a/app/controllers/organizations/organizations_controller.rb +++ b/app/controllers/organizations/organizations_controller.rb @@ -88,7 +88,7 @@ class Organizations::OrganizationsController < Organizations::BaseController projects = @organization.projects projects_count = @organization.projects.count - languages_hash = Rails.cache.fetch("query/organizations/languages/#{@organization.id}/#{projects_count}", :expires_in => 1.days) do + languages_hash = Rails.cache.fetch("query/organizations/languages/#{@organization.id}/#{projects_count}/2023", :expires_in => 1.days) do total_languages(projects) end @@ -97,7 +97,7 @@ class Organizations::OrganizationsController < Organizations::BaseController total_byte_size = sort_hash.values.sum # Rails.logger.info "languages_hash=============#{sort_hash}" sort_hash= sort_hash.transform_values { |v| - ActionController::Base.helpers.number_to_percentage((v / total_byte_size), precision: 1) + ActionController::Base.helpers.number_to_percentage((v * 100 / total_byte_size), precision: 1) }.select { |k, v| v != "0.0%" } render json: sort_hash end From d633550a4f194f1a32fff4dd7e11997602ee6cc2 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 4 May 2023 20:52:56 +0800 Subject: [PATCH 11/16] =?UTF-8?q?file=5Fcommits=20hat=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/gitea/repository/commits/file_list_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/gitea/repository/commits/file_list_service.rb b/app/services/gitea/repository/commits/file_list_service.rb index 77a193475..4a0bbe2cd 100644 --- a/app/services/gitea/repository/commits/file_list_service.rb +++ b/app/services/gitea/repository/commits/file_list_service.rb @@ -14,7 +14,7 @@ class Gitea::Repository::Commits::FileListService < Gitea::ClientService end def call - response = get(url, params, true) + response = get(url, params, false) render_result(response) end From d9b4c30f60d070b0c490418c547ab07af7ddcb9c Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 4 May 2023 21:20:33 +0800 Subject: [PATCH 12/16] =?UTF-8?q?file=5Fcommits=20hat=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=80=A7=E8=83=BD=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/gitea/repository/commits/file_list_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/gitea/repository/commits/file_list_service.rb b/app/services/gitea/repository/commits/file_list_service.rb index 4a0bbe2cd..77a193475 100644 --- a/app/services/gitea/repository/commits/file_list_service.rb +++ b/app/services/gitea/repository/commits/file_list_service.rb @@ -14,7 +14,7 @@ class Gitea::Repository::Commits::FileListService < Gitea::ClientService end def call - response = get(url, params, false) + response = get(url, params, true) render_result(response) end From 769f888f3ea404c7d2e436691c6ec4c983447f1d Mon Sep 17 00:00:00 2001 From: chenjing <28122123@qq.com> Date: Sat, 6 May 2023 01:15:00 +0800 Subject: [PATCH 13/16] replace_file --- app/controllers/repositories_controller.rb | 14 ++++++++++++++ config/routes.rb | 1 + 2 files changed, 15 insertions(+) diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 5d8745397..6cdf3753c 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -211,6 +211,20 @@ class RepositoriesController < ApplicationController end end + def replace_file + #删除 + delete_interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, params[:delete_file].merge(identifier: @project.identifier)) + return render_error(delete_interactor.error) unless delete_interactor.success? + #新建 + interactor = Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params) + if interactor.success? + @file = interactor.result + else + render_error(interactor.error) + end + + end + def delete_file interactor = Gitea::DeleteFileInteractor.call(current_user.gitea_token, @owner.login, params.merge(identifier: @project.identifier)) if interactor.success? diff --git a/config/routes.rb b/config/routes.rb index 7e69c2e38..da3cdd979 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -498,6 +498,7 @@ Rails.application.routes.draw do get :tags get :contributors post :create_file + post :replace_file put :update_file delete :delete_file post :repo_hook From 4c1bcd87a21922f8fa892f067031ca7eeec1e0d8 Mon Sep 17 00:00:00 2001 From: chenjing <28122123@qq.com> Date: Sat, 6 May 2023 14:42:11 +0800 Subject: [PATCH 14/16] add repositories replace_file json --- app/views/repositories/replace_file.json.jbuilder | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/views/repositories/replace_file.json.jbuilder diff --git a/app/views/repositories/replace_file.json.jbuilder b/app/views/repositories/replace_file.json.jbuilder new file mode 100644 index 000000000..5687ee731 --- /dev/null +++ b/app/views/repositories/replace_file.json.jbuilder @@ -0,0 +1,11 @@ +json.name @file['content']['name'] +json.sha @file['content']['sha'] +json.size @file['content']['size'] +json.content @file['content']['content'] +json.encoding @file['content']['encoding'] +json.pr_id @pull_issue.try(:id) +json.commit do + json.message @file['commit']['message'] + json.author @file['commit']['author'] + json.committer @file['commit']['committer'] +end From b86ea02dc9b7f8d97df9b2069c97b4bfd60e85a6 Mon Sep 17 00:00:00 2001 From: chenjing <28122123@qq.com> Date: Sat, 6 May 2023 15:00:06 +0800 Subject: [PATCH 15/16] change response for replace file --- app/controllers/repositories_controller.rb | 1 + app/views/repositories/replace_file.json.jbuilder | 11 ----------- 2 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 app/views/repositories/replace_file.json.jbuilder diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index f729ab394..66b30eef8 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -219,6 +219,7 @@ class RepositoriesController < ApplicationController interactor = Gitea::CreateFileInteractor.call(current_user.gitea_token, @owner.login, content_params) if interactor.success? @file = interactor.result + render_result(0, "替换成功") else render_error(interactor.error) end diff --git a/app/views/repositories/replace_file.json.jbuilder b/app/views/repositories/replace_file.json.jbuilder deleted file mode 100644 index 5687ee731..000000000 --- a/app/views/repositories/replace_file.json.jbuilder +++ /dev/null @@ -1,11 +0,0 @@ -json.name @file['content']['name'] -json.sha @file['content']['sha'] -json.size @file['content']['size'] -json.content @file['content']['content'] -json.encoding @file['content']['encoding'] -json.pr_id @pull_issue.try(:id) -json.commit do - json.message @file['commit']['message'] - json.author @file['commit']['author'] - json.committer @file['commit']['committer'] -end From bc76324290f408f93c83ada2274aebce39abdfd1 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Mon, 8 May 2023 15:36:19 +0800 Subject: [PATCH 16/16] =?UTF-8?q?fixed=20=E9=A1=B9=E7=9B=AE=E6=A0=87?= =?UTF-8?q?=E8=AF=86=E6=A0=A1=E9=AA=8C=E8=A7=84=E5=88=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/libs/custom_regexp.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/libs/custom_regexp.rb b/app/libs/custom_regexp.rb index 6012382b2..b735a631b 100644 --- a/app/libs/custom_regexp.rb +++ b/app/libs/custom_regexp.rb @@ -10,6 +10,7 @@ module CustomRegexp IP = /^((\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d|[1-9]\d|1\d{2}|2[0-4]\d|25[0-5])$/ URL_REGEX = /\A(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]+-?)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?\z/i - REPOSITORY_NAME_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9\-\_\.]+[a-zA-Z0-9]$/ #只含有数字、字母、下划线不能以下划线开头和结尾 + # REPOSITORY_NAME_REGEX = /^[a-zA-Z0-9][a-zA-Z0-9\-\_\.]+[a-zA-Z0-9]$/ #只含有数字、字母、下划线不能以下划线开头和结尾 + REPOSITORY_NAME_REGEX = /^[a-zA-Z0-9\-\_\.]+[a-zA-Z0-9]$/ #只含有数字、字母、下划线不能以下划线开头和结尾 MD_REGEX = /^.+(\.[m|M][d|D])$/ end