Fix updater to follow redirects on latest
This commit is contained in:
parent
409fb0a41d
commit
86e7015528
|
@ -103,8 +103,22 @@ impl AdoptiumAPI {
|
|||
.client
|
||||
.get_async(url)
|
||||
.await
|
||||
.context("Failed to request release")?
|
||||
.into_body();
|
||||
.context("Failed to request release")?;
|
||||
// If we get a 301, respond to it
|
||||
if response.status().as_u16() == 301 {
|
||||
let location = response
|
||||
.headers()
|
||||
.get("location")
|
||||
.context("Failed to get redirect location")?
|
||||
.to_str()
|
||||
.context("Failed to parse redirect location")?;
|
||||
response = self
|
||||
.client
|
||||
.get_async(location)
|
||||
.await
|
||||
.context("Failed to request release")?;
|
||||
}
|
||||
let mut response = response.into_body();
|
||||
let mut body = String::new();
|
||||
response
|
||||
.read_to_string(&mut body)
|
||||
|
@ -137,7 +151,7 @@ impl AdoptiumAPI {
|
|||
let latest: OutputRelease = self
|
||||
.latest(input_versions.most_recent_feature_version, arch, true)
|
||||
.await
|
||||
.context("Failed to get version")?
|
||||
.context("Failed to get version - latest")?
|
||||
.into();
|
||||
let stable: OutputRelease = self
|
||||
.latest(
|
||||
|
@ -146,7 +160,7 @@ impl AdoptiumAPI {
|
|||
true,
|
||||
)
|
||||
.await
|
||||
.context("Failed to get version")?
|
||||
.context("Failed to get version - stable")?
|
||||
.into();
|
||||
let lts: OutputRelease = self
|
||||
.latest(
|
||||
|
@ -156,7 +170,7 @@ impl AdoptiumAPI {
|
|||
true,
|
||||
)
|
||||
.await
|
||||
.context("Failed to get version")?
|
||||
.context("Failed to get version - lts")?
|
||||
.into();
|
||||
Ok(OutputReleases {
|
||||
versions,
|
||||
|
|
Loading…
Reference in New Issue