Merge pull request 'Fix trailing slash in ship URL (and trailing index.html for good measure)' (#1) from khuxkm/cosmic-web:fix-trailing-slashes into master

Reviewed-on: #1
This commit is contained in:
James Tomasino 2021-10-13 11:07:48 +00:00
commit d420e1b4d7
1 changed files with 1 additions and 1 deletions

View File

@ -77,7 +77,7 @@ app.get('/ships', async function (req, res) {
app.get('/ships/*', async function (req, res) {
const list = await head('/var/gopher/listing.gophermap')
const ship = decodeURIComponent(req.path).replace(new RegExp('/ships/', 'i'), '')
const ship = decodeURIComponent(req.path).replace(new RegExp('/ships/', 'i'), '').replace(new RegExp('/(?:index.html)?$',''));
const description = bufferFile('/var/gopher/' + ship + '/.description') || ''
const license = bufferFile('/var/gopher/' + ship + '/LICENSE') || ''
var licenseLabel = ''