Skip to content

Commit

Permalink
Use default branch alias instead of "master"
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnTitor committed Jul 1, 2020
1 parent 44773ef commit f85767e
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,7 @@ impl UrlRelativeEvaluate for SanitizeUrl {
is_media,
add_sanitize_query,
} = is_media_url(url);
new_url += if is_media {
"raw/master"
} else {
"blob/master"
};
new_url += if is_media { "raw/HEAD" } else { "blob/HEAD" };
if !url.starts_with('/') {
new_url.push('/');
}
Expand Down Expand Up @@ -357,7 +353,7 @@ mod tests {
assert_eq!(
result,
format!(
"<p><a href=\"https://{}/rust-lang/test/blob/master/hi\" rel=\"nofollow noopener noreferrer\">hi</a></p>\n",
"<p><a href=\"https://{}/rust-lang/test/blob/HEAD/hi\" rel=\"nofollow noopener noreferrer\">hi</a></p>\n",
host
)
);
Expand All @@ -366,7 +362,7 @@ mod tests {
assert_eq!(
result,
format!(
"<p><a href=\"https://{}/rust-lang/test/blob/master/there\" rel=\"nofollow noopener noreferrer\">there</a></p>\n",
"<p><a href=\"https://{}/rust-lang/test/blob/HEAD/there\" rel=\"nofollow noopener noreferrer\">there</a></p>\n",
host
)
);
Expand All @@ -375,7 +371,7 @@ mod tests {
assert_eq!(
result,
format!(
"<p><img src=\"https://{}/rust-lang/test/raw/master/img.png\" alt=\"alt\"></p>\n",
"<p><img src=\"https://{}/rust-lang/test/raw/HEAD/img.png\" alt=\"alt\"></p>\n",
host
)
);
Expand All @@ -384,7 +380,7 @@ mod tests {
assert_eq!(
result,
format!(
"<p><img src=\"https://{}/rust-lang/test/raw/master/sanitize.svg?sanitize=true\" alt=\"alt\"></p>\n",
"<p><img src=\"https://{}/rust-lang/test/raw/HEAD/sanitize.svg?sanitize=true\" alt=\"alt\"></p>\n",
host
)
);
Expand Down

0 comments on commit f85767e

Please sign in to comment.