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
f27415d7
Commit
f27415d7
authored
Oct 07, 2019
by
John Cai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not load uri types if there are no linkable attributes
parent
7146903d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
lib/banzai/filter/relative_link_filter.rb
lib/banzai/filter/relative_link_filter.rb
+2
-2
spec/lib/banzai/filter/relative_link_filter_spec.rb
spec/lib/banzai/filter/relative_link_filter_spec.rb
+6
-0
No files found.
lib/banzai/filter/relative_link_filter.rb
View file @
f27415d7
...
...
@@ -21,6 +21,7 @@ module Banzai
return
doc
if
context
[
:system_note
]
clear_memoization
(
:linkable_files
)
clear_memoization
(
:linkable_attributes
)
load_uri_types
...
...
@@ -35,10 +36,9 @@ module Banzai
def
load_uri_types
return
unless
linkable_files?
return
unless
linkable_attributes
.
present?
return
{}
unless
repository
clear_memoization
(
:linkable_attributes
)
@uri_types
=
request_path
.
present?
?
get_uri_types
([
request_path
])
:
{}
paths
=
linkable_attributes
.
flat_map
do
|
attr
|
...
...
spec/lib/banzai/filter/relative_link_filter_spec.rb
View file @
f27415d7
...
...
@@ -228,6 +228,12 @@ describe Banzai::Filter::RelativeLinkFilter do
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
'http://example.com'
end
it
'does not call gitaly'
do
filter
(
link
(
'http://example.com'
))
expect
(
described_class
).
not_to
receive
(
:get_blob_types
)
end
it
'supports Unicode filenames'
do
path
=
'files/images/한글.png'
escaped
=
Addressable
::
URI
.
escape
(
path
)
...
...
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