Don't mutate crumbs

aedifex-rework
kts of kettek 2022-03-16 17:13:59 -07:00
parent 70f5d9eb15
commit ef2bbc9812
1 changed files with 1 additions and 1 deletions

View File

@ -43,7 +43,7 @@ module.exports = (plugin, app) => {
// build the location
let loc = '<a href="/">'+app.live.conf['shortname']+'</a>'
let crumbs = req.path.split('/')
let title = crumbs.reverse().filter(v=>v!==''&&v!=='db').map(v=>v.charAt(0).toUpperCase()+v.slice(1)).join(' - ')
let title = [...crumbs].reverse().filter(v=>v!==''&&v!=='db').map(v=>v.charAt(0).toUpperCase()+v.slice(1)).join(' - ')
for (let i = 1; i < crumbs.length; i++) {
if (crumbs[i] == '') continue
loc += ' &#8594 <a href="'+crumbs.slice(0,i).join('/')+'/'+crumbs[i]+'/">'+(crumbs[i].replace('-', ' '))+'</a>'