summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyborus <cyborus@cyborus.xyz>2024-08-10 23:08:48 +0200
committerCyborus <cyborus@cyborus.xyz>2024-08-10 23:08:48 +0200
commitd9256a603cbe057455c5b9ea78fa48c5c550ef2c (patch)
treea373c51757ca36b7364de3d92a3cc9a13ae38f11
parentMerge pull request 'bump version to 0.1.1' (#117) from bump-0.1.1 into main (diff)
downloadforgejo-cli-d9256a603cbe057455c5b9ea78fa48c5c550ef2c.tar.xz
forgejo-cli-d9256a603cbe057455c5b9ea78fa48c5c550ef2c.zip
fix: application settings page url should only be `https`
-rw-r--r--src/auth.rs9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/auth.rs b/src/auth.rs
index 072dc30..44cb20c 100644
--- a/src/auth.rs
+++ b/src/auth.rs
@@ -35,12 +35,9 @@ impl AuthCommand {
oauth_login(keys, host_url, client_id).await?;
} else {
let host_domain = host_url.host_str().ok_or_eyre("invalid host")?;
- let host_path = host_url.path();
- let mut applications_url = host_url.clone();
- applications_url
- .path_segments_mut()
- .map_err(|_| eyre::eyre!("invalid url"))?
- .extend(["user", "settings", "applications"]);
+ let host_path = host_url.path().strip_suffix("/").unwrap_or(host_url.path());
+ let applications_url =
+ format!("https://{host_domain}{host_path}/user/settings/applications");
println!("{host_domain}{host_path} doesn't support easy login");
println!();