(asset: &ReleaseAsset)
| 501 | } |
| 502 | |
| 503 | pub(crate) fn gitlab_https_rejection_reason(asset: &ReleaseAsset) -> Option<String> { |
| 504 | if !is_https_url(&asset.url) { |
| 505 | return Some(format!( |
| 506 | "gitlab asset link URL is not HTTPS: {}; configure the GitLab release link to use \ |
| 507 | HTTPS or a secure direct asset URL", |
| 508 | sanitized_origin(&asset.url) |
| 509 | )); |
| 510 | } |
| 511 | |
| 512 | if let Some(provider_url) = &asset.provider_url { |
| 513 | if !is_https_url(provider_url) { |
| 514 | return Some(format!( |
| 515 | "gitlab direct asset URL is not HTTPS: {}; configure the GitLab release link to \ |
| 516 | use HTTPS or omit the insecure direct asset URL", |
| 517 | sanitized_origin(provider_url) |
| 518 | )); |
| 519 | } |
| 520 | } |
| 521 | |
| 522 | if asset.final_url_https == Some(false) { |
| 523 | let target = asset |
| 524 | .final_url |
| 525 | .as_deref() |
| 526 | .map(sanitized_origin) |
| 527 | .unwrap_or_else(|| "unknown redirect target".to_string()); |
| 528 | return Some(format!( |
| 529 | "gitlab asset redirect target is not HTTPS: {target}; configure the GitLab release \ |
| 530 | link to redirect to HTTPS" |
| 531 | )); |
| 532 | } |
| 533 | |
| 534 | None |
| 535 | } |
| 536 | |
| 537 | pub(crate) fn gitlab_https_diagnostic_url(asset: &ReleaseAsset) -> String { |
| 538 | if asset.final_url_https == Some(false) { |
no test coverage detected