mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-07 22:15:51 +01:00
(refs #211)README.md detection is case insensitive and it also detect README.markdown as same as Github.
This commit is contained in:
@@ -232,6 +232,9 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
(id, path.substring(id.length).replaceFirst("^/", ""))
|
(id, path.substring(id.length).replaceFirst("^/", ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private val readmeFiles = Seq("readme.md", "readme.markdown")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides HTML of the file list.
|
* Provides HTML of the file list.
|
||||||
*
|
*
|
||||||
@@ -251,8 +254,10 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
defining(JGitUtil.getRevCommitFromId(git, objectId)){ revCommit =>
|
defining(JGitUtil.getRevCommitFromId(git, objectId)){ revCommit =>
|
||||||
// get files
|
// get files
|
||||||
val files = JGitUtil.getFileList(git, revision, path)
|
val files = JGitUtil.getFileList(git, revision, path)
|
||||||
// process README.md
|
// process README.md or README.markdown
|
||||||
val readme = files.find(_.name == "README.md").map { file =>
|
val readme = files.find { file =>
|
||||||
|
readmeFiles.contains(file.name.toLowerCase)
|
||||||
|
}.map { file =>
|
||||||
StringUtil.convertFromByteArray(JGitUtil.getContent(Git.open(getRepositoryDir(repository.owner, repository.name)), file.id, true).get)
|
StringUtil.convertFromByteArray(JGitUtil.getContent(Git.open(getRepositoryDir(repository.owner, repository.name)), file.id, true).get)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user