diff --git a/static/galene.js b/static/galene.js index c75ecdf..4b12053 100644 --- a/static/galene.js +++ b/static/galene.js @@ -3089,7 +3089,9 @@ async function serverConnect() { } function start() { - group = decodeURIComponent(location.pathname.replace(/^\/[a-z]*\//, '')); + group = decodeURIComponent( + location.pathname.replace(/^\/[a-z]*\//, '').replace(/\/$/, '') + ); setTitle(capitalise(group)); addFilters(); setMediaChoices(false).then(e => reflectSettings()); diff --git a/static/mainpage.js b/static/mainpage.js index dd81b34..bc68a40 100644 --- a/static/mainpage.js +++ b/static/mainpage.js @@ -24,7 +24,7 @@ document.getElementById('groupform').onsubmit = function(e) { e.preventDefault(); let group = document.getElementById('group').value.trim(); if(group !== '') - location.href = '/group/' + group; + location.href = '/group/' + group + '/'; }; async function listPublicGroups() { @@ -59,8 +59,8 @@ async function listPublicGroups() { let tr = document.createElement('tr'); let td = document.createElement('td'); let a = document.createElement('a'); - a.textContent = group.name; - a.href = '/group/' + encodeURIComponent(group.displayName || group.name); + a.textContent = group.displayName || group.name; + a.href = '/group/' + group.name + '/'; td.appendChild(a); tr.appendChild(td); let td2 = document.createElement('td'); diff --git a/webserver/webserver.go b/webserver/webserver.go index e43a79a..9f5469f 100644 --- a/webserver/webserver.go +++ b/webserver/webserver.go @@ -283,8 +283,9 @@ func groupHandler(w http.ResponseWriter, r *http.Request) { return } - if r.URL.Path != "/group/"+name { - http.Redirect(w, r, "/group/"+name, http.StatusPermanentRedirect) + if r.URL.Path != "/group/"+name+"/" { + http.Redirect(w, r, "/group/"+name+"/", + http.StatusPermanentRedirect) return }