Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
31b02fc2
Commit
31b02fc2
authored
May 25, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't allow spaces in dependency linker value regex
parent
e20eb712
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
lib/gitlab/dependency_linker/base_linker.rb
lib/gitlab/dependency_linker/base_linker.rb
+3
-3
lib/gitlab/dependency_linker/json_linker.rb
lib/gitlab/dependency_linker/json_linker.rb
+2
-2
No files found.
lib/gitlab/dependency_linker/base_linker.rb
View file @
31b02fc2
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
)
})
...
...
lib/gitlab/dependency_linker/json_linker.rb
View file @
31b02fc2
...
...
@@ -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
}
)/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment