Don't allow spaces in dependency linker value regex
This commit is contained in:
parent
e20eb71203
commit
31b02fc210
2 changed files with 5 additions and 5 deletions
|
@ -1,8 +1,8 @@
|
|||
module Gitlab
|
||||
module DependencyLinker
|
||||
class BaseLinker
|
||||
URL_REGEX = %r{https?://[^'"]+}.freeze
|
||||
REPO_REGEX = %r{[^/'"]+/[^/'"]+}.freeze
|
||||
URL_REGEX = %r{https?://[^'" ]+}.freeze
|
||||
REPO_REGEX = %r{[^/'" ]+/[^/'" ]+}.freeze
|
||||
|
||||
class_attribute :file_type
|
||||
|
||||
|
@ -69,7 +69,7 @@ module Gitlab
|
|||
@highlighted_lines ||= highlighted_text.lines
|
||||
end
|
||||
|
||||
def regexp_for_value(value, default: /[^'"]+/)
|
||||
def regexp_for_value(value, default: /[^'" ]+/)
|
||||
case value
|
||||
when Array
|
||||
Regexp.union(value.map { |v| regexp_for_value(v, default: default) })
|
||||
|
|
|
@ -24,8 +24,8 @@ module Gitlab
|
|||
# link_json('specific_package', '1.0.1', link: :key)
|
||||
# # Will link `specific_package` in `"specific_package": "1.0.1"`
|
||||
def link_json(key, value = nil, link: :value, &url_proc)
|
||||
key = regexp_for_value(key, default: /[^"]+/)
|
||||
value = regexp_for_value(value, default: /[^"]+/)
|
||||
key = regexp_for_value(key, default: /[^" ]+/)
|
||||
value = regexp_for_value(value, default: /[^" ]+/)
|
||||
|
||||
if link == :value
|
||||
value = /(?<name>#{value})/
|
||||
|
|
Loading…
Reference in a new issue