mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 14:35:52 +01:00
Fix a few issues detected by static analysis
This commit is contained in:
@@ -98,8 +98,8 @@ object PluginSystem extends PluginService {
|
||||
// Compile and eval Scala source code
|
||||
ScalaPlugin.eval(pluginDir.listFiles.filter(_.getName.endsWith(".scala.html")).map { file =>
|
||||
ScalaPlugin.compileTemplate(
|
||||
id.replaceAll("-", ""),
|
||||
file.getName.replaceAll("\\.scala\\.html$", ""),
|
||||
id.replace("-", ""),
|
||||
file.getName.stripSuffix(".scala.html"),
|
||||
IOUtils.toString(new FileInputStream(file)))
|
||||
}.mkString("\n") + source)
|
||||
|
||||
|
||||
@@ -421,7 +421,7 @@ object IssuesService {
|
||||
conditions.get("author").flatMap(_.headOption),
|
||||
conditions.get("assignee").flatMap(_.headOption),
|
||||
conditions.get("mentions").flatMap(_.headOption),
|
||||
conditions.get("is").getOrElse(Seq.empty).filter(x => x == "open" || x == "closed").headOption.getOrElse("open"),
|
||||
conditions.get("is").getOrElse(Seq.empty).find(x => x == "open" || x == "closed").getOrElse("open"),
|
||||
sort,
|
||||
direction,
|
||||
conditions.get("visibility").flatMap(_.headOption),
|
||||
|
||||
@@ -190,7 +190,7 @@ trait RepositoryService { self: AccountService =>
|
||||
JGitUtil.getRepositoryInfo(repository.userName, repository.repositoryName, baseUrl),
|
||||
repository,
|
||||
issues.size,
|
||||
issues.filter(_ == true).size,
|
||||
issues.count(_ == true),
|
||||
getForkedCount(
|
||||
repository.originUserName.getOrElse(repository.userName),
|
||||
repository.originRepositoryName.getOrElse(repository.repositoryName)
|
||||
@@ -388,4 +388,4 @@ object RepositoryService {
|
||||
|
||||
case class RepositoryTreeNode(owner: String, name: String, children: List[RepositoryTreeNode])
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ trait SystemSettingsService {
|
||||
props.setProperty(LdapUserNameAttribute, ldap.userNameAttribute)
|
||||
ldap.additionalFilterCondition.foreach(x => props.setProperty(LdapAdditionalFilterCondition, x))
|
||||
ldap.fullNameAttribute.foreach(x => props.setProperty(LdapFullNameAttribute, x))
|
||||
ldap.mailAttribute.foreach(x => props.setProperty(LdapMailAddressAttribute, x.toString))
|
||||
ldap.mailAttribute.foreach(x => props.setProperty(LdapMailAddressAttribute, x))
|
||||
ldap.tls.foreach(x => props.setProperty(LdapTls, x.toString))
|
||||
ldap.keystore.foreach(x => props.setProperty(LdapKeystore, x))
|
||||
}
|
||||
|
||||
@@ -217,7 +217,7 @@ object JGitUtil {
|
||||
list.append((treeWalk.getObjectId(0), treeWalk.getFileMode(0), treeWalk.getPathString, treeWalk.getNameString, linkUrl))
|
||||
}
|
||||
|
||||
list = list.map(tuple =>
|
||||
list.transform(tuple =>
|
||||
if (tuple._2 != FileMode.TREE)
|
||||
tuple
|
||||
else
|
||||
|
||||
@@ -12,7 +12,7 @@ trait LinkConverter { self: RequestCache =>
|
||||
issueIdPrefix: String = "#")(implicit context: app.Context): String = {
|
||||
value
|
||||
// escape HTML tags
|
||||
.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll("\"", """)
|
||||
.replace("&", "&").replace("<", "<").replace(">", ">").replace("\"", """)
|
||||
// convert issue id to link
|
||||
.replaceBy(("(?<=(^|\\W))" + issueIdPrefix + "([0-9]+)(?=(\\W|$))").r){ m =>
|
||||
getIssue(repository.owner, repository.name, m.group(2)) match {
|
||||
|
||||
Reference in New Issue
Block a user