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
0
Merge Requests
0
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
Kazuhiko Shiozaki
gitlab-ce
Commits
31172475
Commit
31172475
authored
Apr 15, 2015
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better guard against nil projects in ReferenceFilter
parent
9eaaa7cd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
lib/gitlab/markdown/external_issue_reference_filter.rb
lib/gitlab/markdown/external_issue_reference_filter.rb
+2
-1
lib/gitlab/markdown/reference_filter.rb
lib/gitlab/markdown/reference_filter.rb
+5
-1
No files found.
lib/gitlab/markdown/external_issue_reference_filter.rb
View file @
31172475
...
@@ -25,7 +25,8 @@ module Gitlab
...
@@ -25,7 +25,8 @@ module Gitlab
ISSUE_PATTERN
=
/(?<issue>([A-Z\-]+-)\d+)/
ISSUE_PATTERN
=
/(?<issue>([A-Z\-]+-)\d+)/
def
call
def
call
return
doc
if
project
.
default_issues_tracker?
# Early return if the project isn't using an external tracker
return
doc
if
project
.
nil?
||
project
.
default_issues_tracker?
replace_text_nodes_matching
(
ISSUE_PATTERN
)
do
|
content
|
replace_text_nodes_matching
(
ISSUE_PATTERN
)
do
|
content
|
issue_link_filter
(
content
)
issue_link_filter
(
content
)
...
...
lib/gitlab/markdown/reference_filter.rb
View file @
31172475
...
@@ -42,10 +42,11 @@ module Gitlab
...
@@ -42,10 +42,11 @@ module Gitlab
#
#
# Returns the updated Nokogiri::XML::Document object.
# Returns the updated Nokogiri::XML::Document object.
def
replace_text_nodes_matching
(
pattern
)
def
replace_text_nodes_matching
(
pattern
)
return
doc
if
project
.
nil?
doc
.
search
(
'text()'
).
each
do
|
node
|
doc
.
search
(
'text()'
).
each
do
|
node
|
content
=
node
.
to_html
content
=
node
.
to_html
next
if
project
.
nil?
next
unless
content
.
match
(
pattern
)
next
unless
content
.
match
(
pattern
)
next
if
ignored_ancestry?
(
node
)
next
if
ignored_ancestry?
(
node
)
...
@@ -59,6 +60,9 @@ module Gitlab
...
@@ -59,6 +60,9 @@ module Gitlab
doc
doc
end
end
# Ensure that a :project key exists in context
#
# Note that while the key might exist, its value could be nil!
def
validate
def
validate
needs
:project
needs
:project
end
end
...
...
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