Commit e130e2f6c71c61e1c22c379cf05b86a6fe25ee32
1 parent
979ca7d6
Exists in
master
and in
4 other branches
Check on fs.
Showing
1 changed file
with
9 additions
and
5 deletions
Show diff stats
app/helpers/gitlab_markdown_helper.rb
... | ... | @@ -145,16 +145,20 @@ module GitlabMarkdownHelper |
145 | 145 | end |
146 | 146 | end |
147 | 147 | |
148 | - def file_exists?(document_path) | |
149 | - return false if document_path.nil? || document_path.empty? | |
150 | - full_path = [@path_to_satellite, document_path].join("/") | |
151 | - File.exists?(full_path) | |
148 | + def file_exists?(path) | |
149 | + return false if path.nil? || path.empty? | |
150 | + File.exists?(path_on_fs(path)) | |
152 | 151 | end |
153 | 152 | |
154 | 153 | # Check if the path is pointing to a directory(tree) or a file(blob) |
155 | 154 | # eg. doc/api is directory and doc/README.md is file |
156 | 155 | def local_path(path) |
157 | - File.directory?(Rails.root.join(path)) ? "tree" : "blob" | |
156 | + File.directory?(path_on_fs(path)) ? "tree" : "blob" | |
157 | + end | |
158 | + | |
159 | + # Path to the file in the satellites repository on the filesystem | |
160 | + def path_on_fs(path) | |
161 | + [@path_to_satellite, path].join("/") | |
158 | 162 | end |
159 | 163 | |
160 | 164 | # We will assume that if no ref exists we can point to master | ... | ... |