Redirect to canonical URL when people share the ?edit link

This commit is contained in:
Yohan Boniface 2023-09-23 20:48:45 +02:00
parent 17104bfcbd
commit ff89125c80

View file

@ -263,7 +263,12 @@ L.U.Map.include({
this.onceDataLoaded(function () {
const slug = L.Util.queryString('feature')
if (slug && this.features_index[slug]) this.features_index[slug].view()
if (L.Util.queryString('edit')) this.enableEdit()
if (L.Util.queryString('edit')) {
if (this.hasEditMode()) this.enableEdit()
// Sometimes users share the ?edit link by mistake, let's redirect
// to canonical in this case
else window.location = window.location.pathname
}
if (L.Util.queryString('download')) this.download()
})