diff --git a/core/shared/src/main/scala/coursier/core/Repository.scala b/core/shared/src/main/scala/coursier/core/Repository.scala index 955b35f7d..6afcfec04 100644 --- a/core/shared/src/main/scala/coursier/core/Repository.scala +++ b/core/shared/src/main/scala/coursier/core/Repository.scala @@ -1,8 +1,8 @@ package coursier.core import coursier.Fetch - import coursier.core.compatibility.encodeURIComponent +import coursier.maven.MavenSource import coursier.util.{EitherT, Monad} trait Repository extends Product with Serializable { @@ -24,19 +24,28 @@ object Repository { "SHA-1" -> (underlying.url + ".sha1"), "SHA-256" -> (underlying.url + ".sha256") )) - def withDefaultSignature: Artifact = + def withDefaultSignature: Artifact = { + + val underlyingExt = + if (underlying.attributes.`type`.isEmpty) + "jar" + else + // TODO move MavenSource.typeExtension elsewhere + MavenSource.typeExtension(underlying.attributes.`type`) + underlying.copy(extra = underlying.extra ++ Seq( "sig" -> Artifact( underlying.url + ".asc", Map.empty, Map.empty, - Attributes("asc", ""), + Attributes(s"$underlyingExt.asc", ""), changing = underlying.changing, authentication = underlying.authentication ) .withDefaultChecksums )) + } } } diff --git a/core/shared/src/main/scala/coursier/maven/MavenSource.scala b/core/shared/src/main/scala/coursier/maven/MavenSource.scala index 2fcccfa10..1f6d9c53c 100644 --- a/core/shared/src/main/scala/coursier/maven/MavenSource.scala +++ b/core/shared/src/main/scala/coursier/maven/MavenSource.scala @@ -46,22 +46,17 @@ final case class MavenSource( ) val changing0 = changing.getOrElse(isSnapshot(project.actualVersion)) - var artifact = - Artifact( - root + path.mkString("/"), - Map.empty, - Map.empty, - publication.attributes, - changing = changing0, - authentication = authentication - ) - .withDefaultChecksums - .withDefaultSignature - if (publication.ext == "jar") - artifact = artifact.withDefaultSignature - - artifact + Artifact( + root + path.mkString("/"), + Map.empty, + Map.empty, + publication.attributes, + changing = changing0, + authentication = authentication + ) + .withDefaultChecksums + .withDefaultSignature } val metadataArtifact = artifactOf(Publication(dependency.module.name, "pom", "pom", ""))