@@ -18,9 +18,9 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()):
18
18
import scala .sys .process .*
19
19
println(" ## fetching size of " + url)
20
20
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
24
24
bytes map (b => (responseHeader.head, b))
25
25
}.toOption.flatten.map { case (status, bytes) => (status, bytes match {
26
26
case meh if meh < 1024 => " "
@@ -38,7 +38,7 @@ class MakeDownloadPage(version: String, releaseDate: Date = new Date()):
38
38
39
39
def resourceArchive (cls : String , name : String , ext : String , desc : String ): Future [String ] =
40
40
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"
42
42
resource(cls, fileName, desc, fullUrl, fullUrl)
43
43
44
44
def resource (cls : String , fileName : String , desc : String , fullUrl : String , urlForSize : String ): Future [String ] =
0 commit comments