diff options
author | Sean McGivern <sean@gitlab.com> | 2017-10-11 18:47:03 +0300 |
---|---|---|
committer | Sean McGivern <sean@gitlab.com> | 2017-10-12 13:13:37 +0300 |
commit | 218e1f0963768fced0ed9a33762253c273c72069 (patch) | |
tree | 6ae59ba891b8291400820ec5cbd2f27b8b9cbc48 /app | |
parent | 90f95f2b8c25225bbd5601f9b8412931685d4bc0 (diff) |
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.rb | 4 |
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? |