Unverified Commit 31987259 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix markdown renderer

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent c3be6e42039f
......@@ -166,14 +166,14 @@ def build_nested_path(path, request_path)
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?
# 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"
......@@ -181,6 +181,14 @@ def current_ref
@commit.nil? ? "master" : @commit.id
def current_sha
if @commit
# We will assume that if no ref exists we can point to master
def correct_ref(ref)
ref ? ref : "master"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment