From 786501d288a08f9577717a0378720451906b045e Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Mon, 7 Oct 2024 17:50:16 +0900 Subject: [PATCH] add parentheses. prepare sbt 2.x --- src/main/scala/fm/sbt/S3URLHandler.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/scala/fm/sbt/S3URLHandler.scala b/src/main/scala/fm/sbt/S3URLHandler.scala index 7a67ee7..dd04eb8 100644 --- a/src/main/scala/fm/sbt/S3URLHandler.scala +++ b/src/main/scala/fm/sbt/S3URLHandler.scala @@ -222,7 +222,7 @@ object S3URLHandler { val cname: Option[String] = try { val attrs: Attributes = dnsContext.getAttributes(host, Array("CNAME")) Option(attrs.get("CNAME")) - .flatMap{ attr: Attribute => Option(attr.get) } + .flatMap{ (attr: Attribute) => Option(attr.get) } .collectFirst{ case res: String => res } } catch { case _: NamingException => None @@ -378,7 +378,7 @@ final class S3URLHandler extends URLHandler { val keys: Seq[String] = listing.getCommonPrefixes.asScala ++ listing.getObjectSummaries.asScala.map{ _.getKey } - val res: Seq[URL] = keys.map{ k: String => + val res: Seq[URL] = keys.map{ (k: String) => new URL(url.toString.stripSuffix("/") + "/" + k.stripPrefix(prefix)) } @@ -494,7 +494,7 @@ final class S3URLHandler extends URLHandler { def getBucketAndKey(url: URL): (String, String) = { // The AmazonS3URI constructor should work for standard S3 urls. But if a custom domain is being used // (e.g. snapshots.maven.frugalmechanic.com) then we treat the hostname as the bucket and the path as the key - getAmazonS3URI(url).map{ amzn: AmazonS3URI => + getAmazonS3URI(url).map{ (amzn: AmazonS3URI) => (amzn.getBucket, amzn.getKey) }.getOrElse { // Probably a custom domain name - The host should be the bucket and the path the key