mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-02 11:36:05 +01:00
Use StringUtil#urlEncode() instead of URLEncode#encode().
This commit is contained in:
@@ -6,6 +6,7 @@ import scala.slick.jdbc.{StaticQuery => Q}
|
||||
import Q.interpolation
|
||||
|
||||
import model._
|
||||
import util.StringUtil._
|
||||
import util.Implicits._
|
||||
|
||||
trait IssuesService {
|
||||
@@ -236,7 +237,6 @@ trait IssuesService {
|
||||
}
|
||||
|
||||
object IssuesService {
|
||||
import java.net.URLEncoder
|
||||
import javax.servlet.http.HttpServletRequest
|
||||
|
||||
val IssueLimit = 30
|
||||
@@ -248,8 +248,6 @@ object IssuesService {
|
||||
sort: String = "created",
|
||||
direction: String = "desc"){
|
||||
|
||||
import IssueSearchCondition._
|
||||
|
||||
def toURL: String =
|
||||
"?" + List(
|
||||
if(labels.isEmpty) None else Some("labels=" + urlEncode(labels.mkString(" "))),
|
||||
@@ -265,8 +263,6 @@ object IssuesService {
|
||||
|
||||
object IssueSearchCondition {
|
||||
|
||||
private def urlEncode(value: String): String = URLEncoder.encode(value, "UTF-8")
|
||||
|
||||
private def param(request: HttpServletRequest, name: String, allow: Seq[String] = Nil): Option[String] = {
|
||||
val value = request.getParameter(name)
|
||||
if(value == null || value.isEmpty || (allow.nonEmpty && !allow.contains(value))) None else Some(value)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package view
|
||||
|
||||
import util.StringUtil
|
||||
import org.parboiled.common.StringUtils
|
||||
import org.pegdown._
|
||||
import org.pegdown.ast._
|
||||
@@ -33,11 +34,10 @@ class GitBucketLinkRender(context: app.Context, repository: service.RepositorySe
|
||||
} else {
|
||||
(text, text)
|
||||
}
|
||||
val url = repository.url.replaceFirst("/git/", "/").replaceFirst("\\.git$", "") +
|
||||
"/wiki/" + java.net.URLEncoder.encode(page.replace(' ', '-'), "UTF-8")
|
||||
val url = repository.url.replaceFirst("/git/", "/").replaceFirst("\\.git$", "") + "/wiki/" + StringUtil.urlEncode(page)
|
||||
new Rendering(url, label)
|
||||
} catch {
|
||||
case e: java.io.UnsupportedEncodingException => throw new IllegalStateException();
|
||||
case e: java.io.UnsupportedEncodingException => throw new IllegalStateException
|
||||
}
|
||||
} else {
|
||||
super.render(node)
|
||||
|
||||
Reference in New Issue
Block a user