diff --git a/build.rs b/build.rs index a583417..2f9f843 100644 --- a/build.rs +++ b/build.rs @@ -14,15 +14,16 @@ fn set_repo_url() { if is_git_repo() { repo_url = get_remote_url(); - if !repo_url.ends_with('/') { - repo_url.push('/'); - } if repo_url.starts_with("https://github.com/") { - if is_git_tagged() { - repo_url.push_str(&format!("releases/tag/{}", get_git_tag())); - } else { - repo_url.push_str(&format!("commit/{}", get_git_hash())); - } + // The URL might already end with a '/', but GitHub seems to handle it fine if there's two. + repo_url.push_str(&format!( + "/tree/{}", + if is_git_tagged() { + get_git_tag() + } else { + get_git_hash() + } + )); } } else { println!("Not a Git repo! Skipping repo URL metadata");