Fix text rendering of readme/index

This commit is contained in:
James Lopez 2018-11-14 15:37:30 +01:00
parent 24e5599748
commit 3cd538c2e9
No known key found for this signature in database
GPG key ID: 756BF8E9D7C0CF39
2 changed files with 5 additions and 1 deletions

View file

@ -8,7 +8,7 @@ module Gitlab
module FileDetector
PATTERNS = {
# Project files
readme: %r{\A(readme|index)[^/]*\z}i,
readme: %r{\A(readme|index)(|\.#{Gitlab::MarkupHelper::EXTENSIONS.join('|\.')})$[^\/]*\z}i,
changelog: %r{\A(changelog|history|changes|news)[^/]*\z}i,
license: %r{\A((un)?licen[sc]e|copying)(\.[^/]+)?\z}i,
contributing: %r{\Acontributing[^/]*\z}i,

View file

@ -23,6 +23,10 @@ describe Gitlab::FileDetector do
end
end
it 'returns nil for a README.rb file' do
expect(described_class.type_of('README.rb')).to be_nil
end
it 'returns nil for a README file in a directory' do
expect(described_class.type_of('foo/README.md')).to be_nil
end