summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--head.html5
1 files changed, 3 insertions, 2 deletions
diff --git a/head.html b/head.html
index 8f1b96b..5b1f413 100644
--- a/head.html
+++ b/head.html
@@ -21,11 +21,12 @@ document.addEventListener('DOMContentLoaded', function() {
var m = window.location.pathname.match(/^\/([^/]+)\/about\//);
if (m) {
var repo = m[1];
- var branch = (new URLSearchParams(window.location.search)).get('h') || 'main';
+ // No ?h= on the page: leave it out too, so cgit uses the repository's default branch.
+ var branch = (new URLSearchParams(window.location.search)).get('h');
document.querySelectorAll('div#summary img').forEach(function(img) {
var src = img.getAttribute('src');
if (src && !/^https?:\/\//.test(src) && !/^\//.test(src)) {
- img.src = '/' + repo + '/plain/' + src + '?h=' + branch;
+ img.src = '/' + repo + '/plain/' + src + (branch ? '?h=' + encodeURIComponent(branch) : '');
}
});
}