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
path: root/app
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-03-17 05:58:12 +0300
committerRobert Speicher <robert@gitlab.com>2016-03-17 05:58:12 +0300
commitc280edd31c6ab7f6eb757552d165efc69fcfbc9a (patch)
tree2b7230fd038e2639a67013c1c04fbfb4bd85d00b /app
parent6dad864088bf3e2a944262788c0d49d90ceacfde (diff)
parentf0b052e16868107e1693e9b3454039420bee1dde (diff)
Merge branch 'fix_wiki_links' into 'master'
Fix wiki search results point to raw source Closes https://github.com/gitlabhq/gitlabhq/issues/9581 See merge request !3138
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb4
-rw-r--r--app/views/search/results/_wiki_blob.html.haml4
2 files changed, 6 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 6441cd87e87..e555e97689d 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -758,12 +758,15 @@ class Repository
def parse_search_result(result)
ref = nil
filename = nil
+ basename = nil
startline = 0
result.each_line.each_with_index do |line, index|
if line =~ /^.*:.*:\d+:/
ref, filename, startline = line.split(':')
startline = startline.to_i - index
+ extname = File.extname(filename)
+ basename = filename.sub(/#{extname}$/, '')
break
end
end
@@ -776,6 +779,7 @@ class Repository
OpenStruct.new(
filename: filename,
+ basename: basename,
ref: ref,
startline: startline,
data: data
diff --git a/app/views/search/results/_wiki_blob.html.haml b/app/views/search/results/_wiki_blob.html.haml
index f5859481d46..235106c4f74 100644
--- a/app/views/search/results/_wiki_blob.html.haml
+++ b/app/views/search/results/_wiki_blob.html.haml
@@ -2,9 +2,9 @@
.blob-result
.file-holder
.file-title
- = link_to namespace_project_wiki_path(@project.namespace, @project, wiki_blob.filename) do
+ = link_to namespace_project_wiki_path(@project.namespace, @project, wiki_blob.basename) do
%i.fa.fa-file
%strong
- = wiki_blob.filename
+ = wiki_blob.basename
.file-content.code.term
= render 'shared/file_highlight', blob: wiki_blob, first_line_number: wiki_blob.startline