Skip to content

Commit 3adf361

Browse files
authored
Merge pull request scala#487 from lrytz/dlUrl13
Change download URL to GitHub
2 parents 3593b4e + a50c0bf commit 3adf361

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/scala/MakeDownloadPage.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()):
1818
import scala.sys.process.*
1919
println("## fetching size of "+ url)
2020
scala.util.Try {
21-
val responseHeader = Process(s"curl -m 5 --silent -D - -X HEAD $url").lazyLines
22-
val contentLength = responseHeader.map(_.toLowerCase).find(_.startsWith("content-length"))
23-
val bytes = contentLength.map(_.split(":",2)(1).trim.toInt)
21+
val responseHeader = Process(s"curl -L -m 5 --silent -D - -X HEAD $url").lazyLines
22+
val contentLength = responseHeader.map(_.toLowerCase).filter(_.startsWith("content-length"))
23+
val bytes = contentLength.map(_.split(":",2)(1).trim.toInt).maxOption // maxOption handles redirects
2424
bytes map (b => (responseHeader.head, b))
2525
}.toOption.flatten.map { case (status, bytes) => (status, bytes match {
2626
case meh if meh < 1024 => ""
@@ -38,7 +38,7 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()):
3838

3939
def resourceArchive(cls: String, name: String, ext: String, desc: String): Future[String] =
4040
val fileName = s"$name-$version.$ext"
41-
val fullUrl = s"https://downloads.lightbend.com/scala/$version/$fileName"
41+
val fullUrl = s"https://github.com/scala/scala/releases/download/v$version/$fileName"
4242
resource(cls, fileName, desc, fullUrl, fullUrl)
4343

4444
def resource(cls: String, fileName: String, desc: String, fullUrl: String, urlForSize: String): Future[String] =

0 commit comments

Comments
 (0)