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
31987259
Commit
31987259
authored
Feb 04, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix markdown renderer
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
f297c6b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
app/helpers/gitlab_markdown_helper.rb
app/helpers/gitlab_markdown_helper.rb
+11
-3
No files found.
app/helpers/gitlab_markdown_helper.rb
View file @
31987259
...
...
@@ -166,14 +166,14 @@ module GitlabMarkdownHelper
def
file_exists?
(
path
)
return
false
if
path
.
nil?
||
path
.
empty?
return
@repository
.
blob_at
(
current_
ref
,
path
).
present?
||
@repository
.
tree
(
:head
,
path
).
entries
.
any?
return
@repository
.
blob_at
(
current_
sha
,
path
).
present?
||
@repository
.
tree
(
current_sha
,
path
).
entries
.
any?
end
# Check if the path is pointing to a directory(tree) or a file(blob)
# eg. doc/api is directory and doc/README.md is file
def
local_path
(
path
)
return
"tree"
if
@repository
.
tree
(
:head
,
path
).
entries
.
any?
return
"raw"
if
@repository
.
blob_at
(
current_
ref
,
path
).
image?
return
"tree"
if
@repository
.
tree
(
current_sha
,
path
).
entries
.
any?
return
"raw"
if
@repository
.
blob_at
(
current_
sha
,
path
).
image?
return
"blob"
end
...
...
@@ -181,6 +181,14 @@ module GitlabMarkdownHelper
@commit
.
nil?
?
"master"
:
@commit
.
id
end
def
current_sha
if
@commit
@commit
.
id
else
@repository
.
head_commit
.
sha
end
end
# We will assume that if no ref exists we can point to master
def
correct_ref
(
ref
)
ref
?
ref
:
"master"
...
...
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