summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyborus <cyborus@noreply.codeberg.org>2024-08-10 23:41:54 +0200
committerCyborus <cyborus@noreply.codeberg.org>2024-08-10 23:41:54 +0200
commit1281fb884d011705a63b8936ceec51fd16ec9247 (patch)
treed6ac343301230ebd2ab12a50b6f72fc53380e95d
parentMerge pull request 'feat: add Nix flake' (#118) from LordMZTE/forgejo-cli:nix... (diff)
parentfix: application settings page url should only be `https` (diff)
downloadforgejo-cli-1281fb884d011705a63b8936ceec51fd16ec9247.tar.xz
forgejo-cli-1281fb884d011705a63b8936ceec51fd16ec9247.zip
Merge pull request 'application settings page url should only be `https`' (#119) from app-url-fix into main
Reviewed-on: https://codeberg.org/Cyborus/forgejo-cli/pulls/119
-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!();