diff --git a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala index 1b4ecc9..896ec82 100644 --- a/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala +++ b/src/main/scala/gitbucket/core/controller/RepositoryViewerController.scala @@ -232,7 +232,7 @@ oldFileName = form.oldFileName, content = appendNewLine(convertLineSeparator(form.content, form.lineSeparator), form.lineSeparator), charset = form.charset, - message = if(form.oldFileName.exists(_ == form.newFileName)){ + message = if(form.oldFileName.contains(form.newFileName)){ form.message.getOrElse(s"Update ${form.newFileName}") } else { form.message.getOrElse(s"Rename ${form.oldFileName.get} to ${form.newFileName}") @@ -614,7 +614,7 @@ val permission = JGitUtil.processTree(git, headTip){ (path, tree) => // Add all entries except the editing file - if(!newPath.exists(_ == path) && !oldPath.exists(_ == path)){ + if(!newPath.contains(path) && !oldPath.contains(path)){ builder.add(JGitUtil.createDirCacheEntry(path, tree.getEntryFileMode, tree.getEntryObjectId)) } // Retrieve permission if file exists to keep it diff --git a/src/main/scala/gitbucket/core/service/PullRequestService.scala b/src/main/scala/gitbucket/core/service/PullRequestService.scala index 3807e55..03f2e6e 100644 --- a/src/main/scala/gitbucket/core/service/PullRequestService.scala +++ b/src/main/scala/gitbucket/core/service/PullRequestService.scala @@ -265,7 +265,7 @@ val summary = stateMap.map{ case (keyState, states) => states.size+" "+keyState.name }.mkString(", ") state -> summary } - lazy val statusesAndRequired:List[(CommitStatus, Boolean)] = statuses.map{ s => s -> branchProtection.contexts.exists(_==s.context) } + lazy val statusesAndRequired:List[(CommitStatus, Boolean)] = statuses.map{ s => s -> branchProtection.contexts.contains(s.context) } lazy val isAllSuccess = commitStateSummary._1==CommitState.SUCCESS } } diff --git a/src/main/scala/gitbucket/core/ssh/GitCommand.scala b/src/main/scala/gitbucket/core/ssh/GitCommand.scala index 9461803..0629c14 100644 --- a/src/main/scala/gitbucket/core/ssh/GitCommand.scala +++ b/src/main/scala/gitbucket/core/ssh/GitCommand.scala @@ -105,7 +105,7 @@ } } case AuthType.DeployKeyType(key) => { - getDeployKeys(owner, repoName).filter(sshKey => SshUtil.str2PublicKey(sshKey.publicKey).exists(_ == key)) match { + getDeployKeys(owner, repoName).filter(sshKey => SshUtil.str2PublicKey(sshKey.publicKey).contains(key)) match { case List(_) => true case _ => false } @@ -123,7 +123,7 @@ } } case AuthType.DeployKeyType(key) => { - getDeployKeys(owner, repoName).filter(sshKey => SshUtil.str2PublicKey(sshKey.publicKey).exists(_ == key)) match { + getDeployKeys(owner, repoName).filter(sshKey => SshUtil.str2PublicKey(sshKey.publicKey).contains(key)) match { case List(x) if x.allowWrite => true case _ => false } diff --git a/src/main/scala/gitbucket/core/ssh/PublicKeyAuthenticator.scala b/src/main/scala/gitbucket/core/ssh/PublicKeyAuthenticator.scala index 814e3e9..e3be40d 100644 --- a/src/main/scala/gitbucket/core/ssh/PublicKeyAuthenticator.scala +++ b/src/main/scala/gitbucket/core/ssh/PublicKeyAuthenticator.scala @@ -68,7 +68,7 @@ private def authenticateGenericUser(userName: String, key: PublicKey, session: ServerSession, genericUser: String)(implicit s: Session): Boolean = { // find all users having the key we got from ssh val possibleUserNames = getAllKeys().filter { sshKey => - SshUtil.str2PublicKey(sshKey.publicKey).exists(_ == key) + SshUtil.str2PublicKey(sshKey.publicKey).contains(key) }.map(_.userName).distinct // determine the user - if different accounts share the same key, tough luck @@ -85,7 +85,7 @@ }.getOrElse { // search deploy keys val existsDeployKey = getAllDeployKeys().exists { sshKey => - SshUtil.str2PublicKey(sshKey.publicKey).exists(_ == key) + SshUtil.str2PublicKey(sshKey.publicKey).contains(key) } if(existsDeployKey){ // found deploy key for repository