mirror of https://github.com/sbt/sbt.git
Make version parsing robust to leading or trailing spaces (#355)
This commit is contained in:
parent
8369bacbc1
commit
50f38725d8
|
|
@ -6,8 +6,9 @@ import coursier.core.compatibility._
|
|||
object Parse {
|
||||
|
||||
def version(s: String): Option[Version] = {
|
||||
if (s.isEmpty || s.exists(c => c != '.' && c != '-' && c != '_' && !c.letterOrDigit)) None
|
||||
else Some(Version(s))
|
||||
val trimmed = s.trim
|
||||
if (trimmed.isEmpty || trimmed.exists(c => c != '.' && c != '-' && c != '_' && !c.letterOrDigit)) None
|
||||
else Some(Version(trimmed))
|
||||
}
|
||||
|
||||
def ivyLatestSubRevisionInterval(s: String): Option[VersionInterval] =
|
||||
|
|
|
|||
Loading…
Reference in New Issue