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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
603e04bc
Commit
603e04bc
authored
May 20, 2014
by
Marin Jankovski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure slashes are handled properly.
parent
52c3179b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+8
-0
No files found.
app/helpers/gitlab_markdown_helper.rb
View file @
603e04bc
...
...
@@ -102,6 +102,8 @@ module GitlabMarkdownHelper
path
.
gsub!
(
/(#.*)/
,
""
)
id
=
$1
||
""
file_path
=
relative_file_path
(
path
)
file_path
=
sanitize_slashes
(
file_path
)
[
Gitlab
.
config
.
gitlab
.
relative_url_root
,
@project
.
path_with_namespace
,
...
...
@@ -110,6 +112,12 @@ module GitlabMarkdownHelper
].
compact
.
join
(
"/"
).
gsub
(
/^\/*|\/*$/
,
''
)
+
id
end
def
sanitize_slashes
(
path
)
path
[
0
]
=
""
if
path
.
start_with?
(
"/"
)
path
.
chop
if
path
.
end_with?
(
"/"
)
path
end
def
relative_file_path
(
path
)
requested_path
=
@path
nested_path
=
build_nested_path
(
path
,
requested_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