diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-02-22 22:15:28 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-02-22 22:15:28 +0000 |
commit | d413e4e465747cc20ccbdb238273793b7b7a6aaa (patch) | |
tree | dd3aaa7152991aa3f89e1935cc2849c55c9b59bc /lib | |
parent | 7e37b4e4ef2041f5c1818fdbf7de7fee91608595 (diff) | |
parent | f78cd68ddf4513716b4f006428693756e04a6729 (diff) | |
download | gitlab-ce-d413e4e465747cc20ccbdb238273793b7b7a6aaa.tar.gz |
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.rb | 9 |
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 |