forked from Gitlink/forgeplus
Merge branch 'pre_trustie_server' into trustie_server
This commit is contained in:
commit
b7f93e3725
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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],
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@ module Gitea
|
|||
else
|
||||
@params[:filepath]
|
||||
end
|
||||
rescue
|
||||
@params[:filepath]
|
||||
end
|
||||
|
||||
def valid_params
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -50,18 +50,22 @@ 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 valid_params
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue