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
f97dffdd
Commit
f97dffdd
authored
Mar 14, 2018
by
Jan Beckmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add spec testing '#' escape in relative link filter
parent
2824a725
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
spec/lib/banzai/filter/relative_link_filter_spec.rb
spec/lib/banzai/filter/relative_link_filter_spec.rb
+17
-0
No files found.
spec/lib/banzai/filter/relative_link_filter_spec.rb
View file @
f97dffdd
...
@@ -217,6 +217,23 @@ describe Banzai::Filter::RelativeLinkFilter do
...
@@ -217,6 +217,23 @@ describe Banzai::Filter::RelativeLinkFilter do
end
end
end
end
context
'when ref name contains special chars'
do
let
(
:ref
)
{
'mark#\'@],+;-._/#@!$&()+down'
}
it
'correctly escapes the ref'
do
# Adressable won't escape the '#', so we do this manually
ref_escaped
=
'mark%23\'@%5D,+;-._/%23@!$&()+down'
# Stub this method so the branch doesn't actually need to be in the repo
allow_any_instance_of
(
described_class
).
to
receive
(
:uri_type
).
and_return
(
:raw
)
doc
=
filter
(
link
(
'files/images/logo-black.png'
))
expect
(
doc
.
at_css
(
'a'
)[
'href'
])
.
to
eq
"/
#{
project_path
}
/raw/
#{
ref_escaped
}
/files/images/logo-black.png"
end
end
context
'when requested path is a directory with space in the repo'
do
context
'when requested path is a directory with space in the repo'
do
let
(
:ref
)
{
'master'
}
let
(
:ref
)
{
'master'
}
let
(
:commit
)
{
project
.
commit
(
'38008cb17ce1466d8fec2dfa6f6ab8dcfe5cf49e'
)
}
let
(
:commit
)
{
project
.
commit
(
'38008cb17ce1466d8fec2dfa6f6ab8dcfe5cf49e'
)
}
...
...
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