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-07-07 20:47:03 +0300
committerRobert Speicher <robert@gitlab.com>2016-07-07 20:47:03 +0300
commit86d83a3a85dfc252ee5efb8cc630e1a4295adb93 (patch)
treea6edf4ac392eedea806ec880ae7bbf0af0e26dc3 /app
parent062c7a30742d617d8d0939c3bb6ba733919fe00b (diff)
parentcd63d0a53844507fe7bbf0fabeb89dadecf85fe7 (diff)
Merge branch 'escape-file-extension' into 'master'
Escape file extension when parsing search results When a file extension contains characters which have a meaning in regular expressions, the search may crash. Fixes #18553 See merge request !5141
Diffstat (limited to 'app')
-rw-r--r--app/models/repository.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 078ca8f4e13..d232d422195 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -911,7 +911,7 @@ class Repository
if line =~ /^.*:.*:\d+:/
ref, filename, startline = line.split(':')
startline = startline.to_i - index
- extname = File.extname(filename)
+ extname = Regexp.escape(File.extname(filename))
basename = filename.sub(/#{extname}$/, '')
break
end