mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-06 13:35:50 +01:00
Support plain text readme files (with .txt or no extension).
This commit is contained in:
@@ -251,7 +251,7 @@ trait RepositoryViewerControllerBase extends ControllerBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private val readmeFiles = view.helpers.renderableSuffixes.map(suffix => s"readme${suffix}")
|
private val readmeFiles = view.helpers.renderableSuffixes.map(suffix => s"readme${suffix}") ++ Seq("readme.txt", "readme")
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides HTML of the file list.
|
* Provides HTML of the file list.
|
||||||
|
|||||||
@@ -51,7 +51,11 @@ object helpers extends AvatarImageProvider with LinkConverter with RequestCache
|
|||||||
val fileNameLower = fileName.toLowerCase
|
val fileNameLower = fileName.toLowerCase
|
||||||
renderersBySuffix.find { case (suffix, _) => fileNameLower.endsWith(suffix) } match {
|
renderersBySuffix.find { case (suffix, _) => fileNameLower.endsWith(suffix) } match {
|
||||||
case Some((_, handler)) => handler(fileContent, repository, enableWikiLink, enableRefsLink, context)
|
case Some((_, handler)) => handler(fileContent, repository, enableWikiLink, enableRefsLink, context)
|
||||||
case None => Html("UNSUPPORTED MARKUP TYPE")
|
case None => Html(
|
||||||
|
s"<tt>${
|
||||||
|
fileContent.split("(\\r\\n)|\\n").map(xml.Utility.escape(_)).mkString("<br/>")
|
||||||
|
}</tt>"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user