Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-03-30 02:58:22 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-03-30 02:58:45 +0300
commit1794d7d6a11019da7fe8bb56536f3fce69d1825d (patch)
tree4975bcf5629d6322feab02d1987676ef5fd5411d /lib
parent5825f3338e723e631964bf67d259e3365014a442 (diff)
Add latest changes from gitlab-org/security/gitlab@15-9-stable-ee
Diffstat (limited to 'lib')
-rw-r--r--lib/banzai/filter/inline_observability_filter.rb16
-rw-r--r--lib/extracts_ref.rb14
2 files changed, 5 insertions, 25 deletions
diff --git a/lib/banzai/filter/inline_observability_filter.rb b/lib/banzai/filter/inline_observability_filter.rb
index 50d4aac70cc..334c04f2b59 100644
--- a/lib/banzai/filter/inline_observability_filter.rb
+++ b/lib/banzai/filter/inline_observability_filter.rb
@@ -1,7 +1,5 @@
# frozen_string_literal: true
-require 'uri'
-
module Banzai
module Filter
class InlineObservabilityFilter < ::Banzai::Filter::InlineEmbedsFilter
@@ -17,8 +15,7 @@ module Banzai
doc.document.create_element(
'div',
class: 'js-render-observability',
- 'data-frame-url': url,
- 'data-observability-url': Gitlab::Observability.observability_url
+ 'data-frame-url': url
)
end
@@ -31,15 +28,8 @@ module Banzai
# obtained from the target link
def element_to_embed(node)
url = node['href']
- uri = URI.parse(url)
- observability_uri = URI.parse(Gitlab::Observability.observability_url)
-
- if uri.scheme == observability_uri.scheme &&
- uri.port == observability_uri.port &&
- uri.host.casecmp?(observability_uri.host) &&
- uri.path.downcase.exclude?("auth/start")
- create_element(url)
- end
+
+ create_element(url)
end
private
diff --git a/lib/extracts_ref.rb b/lib/extracts_ref.rb
index 49c9772f760..dba1aad639c 100644
--- a/lib/extracts_ref.rb
+++ b/lib/extracts_ref.rb
@@ -5,8 +5,7 @@
# Can be extended for different types of repository object, e.g. Project or Snippet
module ExtractsRef
InvalidPathError = Class.new(StandardError)
- BRANCH_REF_TYPE = 'heads'
- TAG_REF_TYPE = 'tags'
+
# Given a string containing both a Git tree-ish, such as a branch or tag, and
# a filesystem path joined by forward slashes, attempts to separate the two.
#
@@ -92,7 +91,7 @@ module ExtractsRef
def ref_type
return unless params[:ref_type].present?
- params[:ref_type] == TAG_REF_TYPE ? TAG_REF_TYPE : BRANCH_REF_TYPE
+ params[:ref_type] == 'tags' ? 'tags' : 'heads'
end
private
@@ -155,13 +154,4 @@ module ExtractsRef
def repository_container
raise NotImplementedError
end
-
- def ambiguous_ref?(project, ref)
- return true if project.repository.ambiguous_ref?(ref)
-
- return false unless ref&.starts_with?('refs/')
-
- unprefixed_ref = ref.sub(%r{^refs/(heads|tags)/}, '')
- project.repository.commit(unprefixed_ref).present?
- end
end