diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 09:11:22 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-09-20 09:11:22 +0300 |
commit | 13ad005a25f163520ff94b90cdd53495c5a0b5c4 (patch) | |
tree | 5b2fb4262633c200a8e701de2d1fa97105641ed2 /lib/api | |
parent | 9a61b4604efea1c8e57f4c90addbc94ecbe874de (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/api.rb | 2 | ||||
-rw-r--r-- | lib/api/debian_group_packages.rb | 2 | ||||
-rwxr-xr-x | lib/api/go_proxy.rb | 2 | ||||
-rw-r--r-- | lib/api/helpers.rb | 4 | ||||
-rw-r--r-- | lib/api/v3/github.rb | 2 | ||||
-rw-r--r-- | lib/api/validations/validators/git_ref.rb | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/lib/api/api.rb b/lib/api/api.rb index 8ebd7f83acb..c36ee9dc064 100644 --- a/lib/api/api.rb +++ b/lib/api/api.rb @@ -7,7 +7,7 @@ module API LOG_FILENAME = Rails.root.join("log", "api_json.log") - NO_SLASH_URL_PART_REGEX = %r{[^/]+}.freeze + NO_SLASH_URL_PART_REGEX = %r{[^/]+} NAMESPACE_OR_PROJECT_REQUIREMENTS = { id: NO_SLASH_URL_PART_REGEX }.freeze COMMIT_ENDPOINT_REQUIREMENTS = NAMESPACE_OR_PROJECT_REQUIREMENTS.merge(sha: NO_SLASH_URL_PART_REGEX).freeze USER_REQUIREMENTS = { user_id: NO_SLASH_URL_PART_REGEX }.freeze diff --git a/lib/api/debian_group_packages.rb b/lib/api/debian_group_packages.rb index 7c64dc2f877..9ceccbb5635 100644 --- a/lib/api/debian_group_packages.rb +++ b/lib/api/debian_group_packages.rb @@ -3,7 +3,7 @@ module API class DebianGroupPackages < ::API::Base PACKAGE_FILE_REQUIREMENTS = ::API::DebianProjectPackages::PACKAGE_FILE_REQUIREMENTS.merge( - project_id: %r{[0-9]+}.freeze + project_id: %r{[0-9]+} ).freeze resource :groups, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do diff --git a/lib/api/go_proxy.rb b/lib/api/go_proxy.rb index 8fde40a4713..3933e07d150 100755 --- a/lib/api/go_proxy.rb +++ b/lib/api/go_proxy.rb @@ -10,7 +10,7 @@ module API urgency :low # basic semver, except case encoded (A => !a) - MODULE_VERSION_REGEX = /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([-.!a-z0-9]+))?(?:\+([-.!a-z0-9]+))?/.freeze + MODULE_VERSION_REGEX = /v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([-.!a-z0-9]+))?(?:\+([-.!a-z0-9]+))?/ MODULE_VERSION_REQUIREMENTS = { module_version: MODULE_VERSION_REGEX }.freeze diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb index e967b88e500..9e04cf955df 100644 --- a/lib/api/helpers.rb +++ b/lib/api/helpers.rb @@ -19,7 +19,7 @@ module API API_TOKEN_ENV = 'gitlab.api.token' API_EXCEPTION_ENV = 'gitlab.api.exception' API_RESPONSE_STATUS_CODE = 'gitlab.api.response_status_code' - INTEGER_ID_REGEX = /^-?\d+$/.freeze + INTEGER_ID_REGEX = /^-?\d+$/ def logger API.logger @@ -237,7 +237,7 @@ module API end def check_namespace_access(namespace) - return namespace if can?(current_user, :read_namespace, namespace) + return namespace if can?(current_user, :read_namespace_via_membership, namespace) not_found!('Namespace') end diff --git a/lib/api/v3/github.rb b/lib/api/v3/github.rb index 7348ed612fc..0ce5cdd06de 100644 --- a/lib/api/v3/github.rb +++ b/lib/api/v3/github.rb @@ -9,7 +9,7 @@ module API module V3 class Github < ::API::Base - NO_SLASH_URL_PART_REGEX = %r{[^/]+}.freeze + NO_SLASH_URL_PART_REGEX = %r{[^/]+} ENDPOINT_REQUIREMENTS = { namespace: NO_SLASH_URL_PART_REGEX, project: NO_SLASH_URL_PART_REGEX, diff --git a/lib/api/validations/validators/git_ref.rb b/lib/api/validations/validators/git_ref.rb index 711c272ab4e..4e113a4ef67 100644 --- a/lib/api/validations/validators/git_ref.rb +++ b/lib/api/validations/validators/git_ref.rb @@ -10,7 +10,7 @@ module API # We have skipped some checks that are optional and can be skipped for exception. # We also check for control characters, More info on ctrl chars - https://ruby-doc.org/core-2.7.0/Regexp.html#class-Regexp-label-Character+Classes INVALID_CHARS = Regexp.union('..', '\\', '@', '@{', ' ', '~', '^', ':', '*', '?', '[', /[[:cntrl:]]/).freeze - GIT_REF_LENGTH = (1..1024).freeze + GIT_REF_LENGTH = (1..1024) def validate_param!(attr_name, params) revision = params[attr_name] |