Fix coursierint NPE when credential realm is null

As stated in #5492 and #2366 some artifact hosting services (at least
Azure Artifacts, seems to affect GCP as well) do not offer a stable HTTP
Auth realm that can be safely set in SBT credentials, hence the need to
support null or empty Credentials.

The Ivy (publishing) side of the issue was fixed in sbt/ivy#36

As to the resolving side, This commit is only part of the solution as it
just prevents an NPE and does not consider if coursier itself will fall
back to finding credentials with a null realm that matches the server
hostname.

Related-to: #5492
Related-to: #2366
Signed-off-by: Erwan Queffelec <erwan.queffelec@gmail.com>
This commit is contained in:
Erwan Queffelec 2020-05-03 15:53:19 +02:00
parent 5a529bf10c
commit 23fdb324cb
1 changed files with 1 additions and 1 deletions

View File

@ -231,7 +231,7 @@ object CoursierInputsTasks {
.withHost(c.host)
.withUsername(c.userName)
.withPassword(c.passwd)
.withRealm(Some(c.realm).filter(_.nonEmpty))
.withRealm(Option(c.realm).filter(_.nonEmpty))
.withHttpsOnly(false)
.withMatchHost(true)
}