diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-09-23 15:55:14 +0000 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-09-23 15:55:14 +0000 |
commit | e5fb2ad908efb02d100386e4a45071554d6bccd1 (patch) | |
tree | de56dabb9da7ca2d30de2ae68dc762bee589b2f2 | |
parent | ea1eda2124d6910de533bbd9d8fea568e7a3dd8c (diff) | |
parent | 1e980ffbad96cdda4f34d4028b052e275db572ef (diff) | |
download | gitlab-ce-e5fb2ad908efb02d100386e4a45071554d6bccd1.tar.gz |
Merge branch 'search-wiki-keyword' into 'master'
Prevent 500 error on search results if description contains relative link
Bug: If I add relative link to comment or description and search for it - I get 500 error on search page.
Reason for this is that we use `@repository` variable. But for pages like search it does not assigned.
In future we should avoid using such variables. Especially in markdown parser that can be used on different pages
Fixes #1601
See merge request !1111
-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 |