Skip to content

Commit

Permalink
fix opening an ip
Browse files Browse the repository at this point in the history
  • Loading branch information
liias committed Jan 6, 2023
1 parent 0e8176a commit 4db9fdd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/browser_repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ fn convert_spotify_uri(_: Option<&String>, url: &str) -> String {
}

let url1 = result.unwrap();
//let domain_maybe = url1.domain();
//let host_maybe = url1.host_str();
// verify it's "open.spotify.com" ?
//let x = url1.path();

Expand Down
10 changes: 7 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ fn get_rule_for_source_app_and_url<'a>(
return None;
}
let given_url = url_result.unwrap();
let given_url_domain = given_url.domain().unwrap();
let given_url_host_maybe = given_url.host_str();

for r in opening_rules {
let mut source_app_match = false;
Expand All @@ -371,8 +371,12 @@ fn get_rule_for_source_app_and_url<'a>(
continue;
}
let url_rule = url_rule_result.unwrap();
let domains_match = url_rule.domain().unwrap() == given_url_domain;
domains_match

if let Some(given_url_host) = given_url_host_maybe {
url_rule.host_str().unwrap() == given_url_host
} else {
false
}
} else {
true
};
Expand Down
2 changes: 1 addition & 1 deletion src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ impl FilteredBrowsersLens {
let url_result = Url::parse(url_str.as_str());
let domain_maybe = url_result
.ok()
.map(|url| url.domain().map(|d| d.to_string()))
.map(|url| url.host_str().map(|d| d.to_string()))
.flatten();

let mut filtered: Vec<UIBrowser> = data
Expand Down

0 comments on commit 4db9fdd

Please sign in to comment.