Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-09-23 18:56:41 +0400
committerMarin Jankovski <marin@gitlab.com>2014-09-23 19:56:16 +0400
commitaebe3317b9b9db1290ad4584d78223e9fecc5e0b (patch)
tree90d8a7dc4f2338e52890aafd85e1f591106f0ed7
parent0396f38773d6163bde3416ea09b1fe452feae6c7 (diff)
Prevent 500 error on search results if description contains relative link
-rw-r--r--app/helpers/gitlab_markdown_helper.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb
index e4aa90154fb..b62244c4a2d 100644
--- a/app/helpers/gitlab_markdown_helper.rb
+++ b/app/helpers/gitlab_markdown_helper.rb
@@ -65,7 +65,12 @@ module GitlabMarkdownHelper
paths.uniq.each do |file_path|
# If project does not have repository
# its nothing to rebuild
- if @repository.exists? && !@repository.empty?
+ #
+ # TODO: pass project variable to markdown helper instead of using
+ # instance variable. Right now it generates invalid path for pages out
+ # of project scope. Example: search results where can be rendered markdown
+ # from different projects
+ if @repository && @repository.exists? && !@repository.empty?
new_path = rebuild_path(file_path)
# Finds quoted path so we don't replace other mentions of the string
# eg. "doc/api" will be replaced and "/home/doc/api/text" won't