summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@gitlab.com>2017-10-11 16:47:03 +0100
committerSean McGivern <sean@gitlab.com>2017-10-12 11:13:37 +0100
commit218e1f0963768fced0ed9a33762253c273c72069 (patch)
tree6ae59ba891b8291400820ec5cbd2f27b8b9cbc48 /app
parent90f95f2b8c25225bbd5601f9b8412931685d4bc0 (diff)
downloadgitlab-ce-218e1f0963768fced0ed9a33762253c273c72069.tar.gz
Match full file path in FileDetector
The basename appears to have been a holdover from the past - it doesn't look necessary now. Some of the regexes were unanchored on one side, so explicitly ensure that they only match the root. Apart from that, this means that pushing to foo/README.md will no longer invalidate the main README cache for a project.
Diffstat (limited to 'app')
-rw-r--r--app/models/blob.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/models/blob.rb b/app/models/blob.rb
index 954d4e4d779..ad0bc2e2ead 100644
--- a/app/models/blob.rb
+++ b/app/models/blob.rb
@@ -156,7 +156,9 @@ class Blob < SimpleDelegator
end
def file_type
- Gitlab::FileDetector.type_of(path)
+ name = File.basename(path)
+
+ Gitlab::FileDetector.type_of(path) || Gitlab::FileDetector.type_of(name)
end
def video?