diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-23 17:56:41 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-09-23 17:56:41 +0300 |
commit | 1e980ffbad96cdda4f34d4028b052e275db572ef (patch) | |
tree | 2b1557319730cb70476d5cf0589a31bcb78fac29 /app/helpers | |
parent | e586ee347f7740d2c16018a547fce7d3de9c3eb5 (diff) | |
download | gitlab-ce-1e980ffbad96cdda4f34d4028b052e275db572ef.tar.gz |
Prevent 500 error on search results if description contains relative link
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/gitlab_markdown_helper.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index d269323542f..0365681a128 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -73,7 +73,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 |