mirror of https://github.com/sbt/sbt.git
Proper URL encoding in proxied JSONP request
This commit is contained in:
parent
754ffcbd38
commit
830a81c651
|
|
@ -31,11 +31,7 @@ object Remote {
|
|||
}
|
||||
}
|
||||
|
||||
def proxiedJsonp(url: String)(implicit executionContext: ExecutionContext): Future[String] =
|
||||
if (url.contains("{")) Future.successful("") // jsonp callback never gets executed in this case (empty response)
|
||||
else {
|
||||
|
||||
// FIXME url is put between quotes in the YQL query, which should sometimes require some extra encoding
|
||||
def proxiedJsonp(url: String)(implicit executionContext: ExecutionContext): Future[String] = {
|
||||
val url0 =
|
||||
"https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20xml%20where%20url%3D%22" +
|
||||
encodeURIComponent(url) +
|
||||
|
|
@ -43,8 +39,6 @@ object Remote {
|
|||
|
||||
val p = Promise[String]()
|
||||
|
||||
// FIXME Promise may not be always completed in case of failure
|
||||
|
||||
g.jsonp(url0, (res: js.Dynamic) => if (!p.isCompleted) {
|
||||
val success = !js.isUndefined(res) && !js.isUndefined(res.results)
|
||||
if (success)
|
||||
|
|
@ -89,12 +83,13 @@ case class Remote(base: String, logger: Option[Logger] = None) extends Repositor
|
|||
version: String,
|
||||
cachePolicy: CachePolicy): EitherT[Task, String, Project] = {
|
||||
|
||||
val relPath =
|
||||
val relPath = {
|
||||
module.organization.split('.').toSeq ++ Seq(
|
||||
module.name,
|
||||
version,
|
||||
s"${module.name}-$version.pom"
|
||||
)
|
||||
} .map(Remote.encodeURIComponent)
|
||||
|
||||
val url = base + relPath.mkString("/")
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue