feat: dont canonicalize `patched+` to https for github

This commit is contained in:
Weihang Lo 2024-04-15 21:27:19 -04:00
parent 0bb3ad1352
commit 2e1e117a33
No known key found for this signature in database
GPG Key ID: D7DBF189825E82E7
1 changed files with 6 additions and 1 deletions

View File

@ -39,7 +39,12 @@ impl CanonicalUrl {
// almost certainly not using the same case conversion rules that GitHub
// does. (See issue #84)
if url.host_str() == Some("github.com") {
url = format!("https{}", &url[url::Position::AfterScheme..])
let proto = if url.scheme().starts_with("patched+") {
"patched+https"
} else {
"https"
};
url = format!("{proto}{}", &url[url::Position::AfterScheme..])
.parse()
.unwrap();
let path = url.path().to_lowercase();