From a8d5a2c4c9d889e7de4d9fcb6c0a95753e9792f5 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Thu, 14 Jan 2016 01:05:36 +0100 Subject: [PATCH] Accept absent checksums by default SHA-1 still checked first if present --- cache/src/main/scala/coursier/Cache.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cache/src/main/scala/coursier/Cache.scala b/cache/src/main/scala/coursier/Cache.scala index 7448fb091..121f4416d 100644 --- a/cache/src/main/scala/coursier/Cache.scala +++ b/cache/src/main/scala/coursier/Cache.scala @@ -16,6 +16,9 @@ import java.io.{ Serializable => _, _ } object Cache { + // Check SHA-1 if available, else be fine with no checksum + val defaultChecksums = Seq(Some("SHA-1"), None) + private def withLocal(artifact: Artifact, cache: Seq[(String, File)]): Artifact = { def local(url: String) = if (url.startsWith("file:///")) @@ -398,7 +401,7 @@ object Cache { artifact: Artifact, cache: Seq[(String, File)] = default, cachePolicy: CachePolicy = CachePolicy.FetchMissing, - checksums: Seq[Option[String]] = Seq(Some("SHA-1")), + checksums: Seq[Option[String]] = defaultChecksums, logger: Option[Logger] = None, pool: ExecutorService = defaultPool ): EitherT[Task, FileError, File] = { @@ -449,7 +452,7 @@ object Cache { def fetch( cache: Seq[(String, File)] = default, cachePolicy: CachePolicy = CachePolicy.FetchMissing, - checksums: Seq[Option[String]] = Seq(Some("SHA-1")), + checksums: Seq[Option[String]] = defaultChecksums, logger: Option[Logger] = None, pool: ExecutorService = defaultPool ): Fetch.Content[Task] = {