mirror of
https://codeberg.org/Cyborus/forgejo-cli.git
synced 2024-11-10 03:59:31 +01: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(repo) = repo {
|
||||||
if let Some(host) = &repo.host {
|
if let Some(host) = &repo.host {
|
||||||
if let Ok(url) = Url::parse(host) {
|
repo_url = Url::parse(host)
|
||||||
repo_url = Some(url);
|
.ok()
|
||||||
} else if let Ok(url) = Url::parse(&format!("https://{host}/")) {
|
.filter(|x| !x.cannot_be_a_base())
|
||||||
repo_url = Some(url);
|
.or_else(|| Url::parse(&format!("https://{host}/")).ok())
|
||||||
}
|
|
||||||
}
|
}
|
||||||
repo_name = Some(RepoName {
|
repo_name = Some(RepoName {
|
||||||
owner: repo.owner.clone(),
|
owner: repo.owner.clone(),
|
||||||
|
@ -67,6 +66,7 @@ impl RepoInfo {
|
||||||
let host_url = host.and_then(|host| {
|
let host_url = host.and_then(|host| {
|
||||||
Url::parse(host)
|
Url::parse(host)
|
||||||
.ok()
|
.ok()
|
||||||
|
.filter(|x| !x.cannot_be_a_base())
|
||||||
.or_else(|| Url::parse(&format!("https://{host}/")).ok())
|
.or_else(|| Url::parse(&format!("https://{host}/")).ok())
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue