mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-09-20 08:05:04 +02:00
Merge pull request 'don't accept cannot-be-a-base urls in parsing' (#123) from not-base-fix into main
Reviewed-on: https://codeberg.org/Cyborus/forgejo-cli/pulls/123
This commit is contained in:
commit
23311d2807
1 changed files with 5 additions and 5 deletions
10
src/repo.rs
10
src/repo.rs
|
@ -49,11 +49,10 @@ impl RepoInfo {
|
|||
|
||||
if let Some(repo) = repo {
|
||||
if let Some(host) = &repo.host {
|
||||
if let Ok(url) = Url::parse(host) {
|
||||
repo_url = Some(url);
|
||||
} else if let Ok(url) = Url::parse(&format!("https://{host}/")) {
|
||||
repo_url = Some(url);
|
||||
}
|
||||
repo_url = Url::parse(host)
|
||||
.ok()
|
||||
.filter(|x| !x.cannot_be_a_base())
|
||||
.or_else(|| Url::parse(&format!("https://{host}/")).ok())
|
||||
}
|
||||
repo_name = Some(RepoName {
|
||||
owner: repo.owner.clone(),
|
||||
|
@ -67,6 +66,7 @@ impl RepoInfo {
|
|||
let host_url = host.and_then(|host| {
|
||||
Url::parse(host)
|
||||
.ok()
|
||||
.filter(|x| !x.cannot_be_a_base())
|
||||
.or_else(|| Url::parse(&format!("https://{host}/")).ok())
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue