GitLab wurde aktualisiert. Dank regelmäßiger Updates bleibt das THM GitLab sicher und Sie profitieren von den neuesten Funktionen. Vielen Dank für Ihre Geduld.

Commit d453b24a authored by Robert Speicher's avatar Robert Speicher
Browse files

Merge branch 'validate-readme-format' into 'master'

Validate README format

Take the first previewable README file as project's README, otherwise if
none file is available, or we can't preview any of them, we assume that
project doesn't have a README file.

Fixes #3978
parents 67a927ff 8e33ec1d
......@@ -19,6 +19,7 @@ v 8.4.0 (unreleased)
- Show 'All' tab by default in the builds page
- Fix API project lookups when querying with a namespace with dots (Stan Hu)
- Update version check images to use SVG
- Validate README format before displaying
v 8.3.3 (unreleased)
- Fix project transfer e-mail sending incorrect paths in e-mail notification (Stan Hu)
......@@ -17,18 +17,16 @@ def initialize(repository, sha, path = '/')
def readme
return @readme if defined?(@readme)
available_readmes =
# Take the first previewable readme, or return nil if none is available or
# we can't preview any of them
readme_tree = blobs.find do |blob|
blob.readme? && (previewable?( || plain?(
if available_readmes.count == 0
if readme_tree.nil?
return @readme = nil
# Take the first previewable readme, or the first available readme, if we
# can't preview any of them
readme_tree = available_readmes.find do |readme|
end || available_readmes.first
readme_path = path == '/' ? : File.join(path,
git_repo = repository.raw_repository
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment