Handle whitespace in file resolver path (#68)

Fixes https://github.com/coursier/coursier/issues/1175
This commit is contained in:
eugene yokota 2019-05-21 04:03:27 -04:00 committed by Alexandre Archambault
parent 1499a15730
commit 745894efc5
4 changed files with 25 additions and 3 deletions

View File

@ -52,6 +52,11 @@ object Resolvers {
None
}
// this handles whitespace in path
private def pathToUriString(path: String): String = {
"file://" + path.replaceAllLiterally(" ", "%20")
}
def repository(
resolver: Resolver,
ivyProperties: Map[String, String],
@ -72,8 +77,8 @@ object Resolvers {
case None =>
val repo = IvyRepository.parse(
"file://" + r.patterns.artifactPatterns.head,
metadataPatternOpt = Some("file://" + r.patterns.ivyPatterns.head),
pathToUriString(r.patterns.artifactPatterns.head),
metadataPatternOpt = Some(pathToUriString(r.patterns.ivyPatterns.head)),
changing = Some(true),
properties = ivyProperties,
dropInfoAttributes = true,
@ -90,7 +95,7 @@ object Resolvers {
Some(repo)
case Some(mavenCompatibleBase) =>
mavenRepositoryOpt("file://" + mavenCompatibleBase, log, authentication)
mavenRepositoryOpt(pathToUriString(mavenCompatibleBase), log, authentication)
}
case r: URLRepository if patternMatchGuard(r.patterns) =>

View File

@ -0,0 +1,3 @@
scalaVersion := "2.11.8"
resolvers += Resolver.file("space-repo", file(raw"/tmp/space the final frontier/repo"))(Resolver.ivyStylePatterns)

View File

@ -0,0 +1,13 @@
addSbtPlugin {
val name = sys.props.getOrElse(
"plugin.name",
sys.error("plugin.name Java property not set")
)
val version = sys.props.getOrElse(
"plugin.version",
sys.error("plugin.version Java property not set")
)
"io.get-coursier" % name % version
}

View File

@ -0,0 +1 @@
> update