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
Boxiang Sun
gitlab-ce
Commits
35a39c1d
Commit
35a39c1d
authored
Jun 18, 2019
by
Mario de la Ossa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not rewrite relative links for system notes
parent
ba952d53
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
1 deletion
+15
-1
app/models/note.rb
app/models/note.rb
+1
-1
changelogs/unreleased/bug-63162-duplicate_path_in_links.yml
changelogs/unreleased/bug-63162-duplicate_path_in_links.yml
+5
-0
lib/banzai/filter/relative_link_filter.rb
lib/banzai/filter/relative_link_filter.rb
+2
-0
spec/lib/banzai/filter/relative_link_filter_spec.rb
spec/lib/banzai/filter/relative_link_filter_spec.rb
+7
-0
No files found.
app/models/note.rb
View file @
35a39c1d
...
...
@@ -457,7 +457,7 @@ class Note < ApplicationRecord
end
def
banzai_render_context
(
field
)
super
.
merge
(
noteable:
noteable
)
super
.
merge
(
noteable:
noteable
,
system_note:
system
?
)
end
def
retrieve_upload
(
_identifier
,
paths
)
...
...
changelogs/unreleased/bug-63162-duplicate_path_in_links.yml
0 → 100644
View file @
35a39c1d
---
title
:
Fixed 'diff version changes' link not working
merge_request
:
29825
author
:
type
:
fixed
lib/banzai/filter/relative_link_filter.rb
View file @
35a39c1d
...
...
@@ -17,6 +17,8 @@ module Banzai
include
Gitlab
::
Utils
::
StrongMemoize
def
call
return
doc
if
context
[
:system_note
]
@uri_types
=
{}
clear_memoization
(
:linkable_files
)
...
...
spec/lib/banzai/filter/relative_link_filter_spec.rb
View file @
35a39c1d
...
...
@@ -101,6 +101,13 @@ describe Banzai::Filter::RelativeLinkFilter do
.
to
eq
"/
#{
project_path
}
/blob/
#{
ref
}
/doc/api/README.md"
end
it
'does not modify relative URLs in system notes'
do
path
=
"
#{
project_path
}
/merge_requests/1/diffs"
doc
=
filter
(
link
(
path
),
system_note:
true
)
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
path
end
it
'ignores absolute URLs with two leading slashes'
do
doc
=
filter
(
link
(
'//doc/api/README.md'
))
expect
(
doc
.
at_css
(
'a'
)[
'href'
]).
to
eq
'//doc/api/README.md'
...
...
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