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:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-02-23 01:15:28 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2019-02-23 01:15:28 +0300
commitd413e4e465747cc20ccbdb238273793b7b7a6aaa (patch)
treedd3aaa7152991aa3f89e1935cc2849c55c9b59bc /lib
parent7e37b4e4ef2041f5c1818fdbf7de7fee91608595 (diff)
parentf78cd68ddf4513716b4f006428693756e04a6729 (diff)
Merge branch '58062-tracing-url-template-render-using-string-format-does-not-play-well-with-urls' into 'master'
Switch back to using regexps in tracing_url_template Closes #58062 See merge request gitlab-org/gitlab-ce!25491
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/tracing.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/gitlab/tracing.rb b/lib/gitlab/tracing.rb
index 0d9b0be1c8e..29517591c51 100644
--- a/lib/gitlab/tracing.rb
+++ b/lib/gitlab/tracing.rb
@@ -27,10 +27,11 @@ module Gitlab
def self.tracing_url
return unless tracing_url_enabled?
- tracing_url_template % {
- correlation_id: Gitlab::CorrelationId.current_id.to_s,
- service: Gitlab.process_name
- }
+ # Avoid using `format` since it can throw TypeErrors
+ # which we want to avoid on unsanitised env var input
+ tracing_url_template.to_s
+ .gsub(/\{\{\s*correlation_id\s*\}\}/, Gitlab::CorrelationId.current_id.to_s)
+ .gsub(/\{\{\s*service\s*\}\}/, Gitlab.process_name)
end
end
end