Fix trailing slash in ship URL (and trailing index.html for good measure) #1
|
@ -77,7 +77,7 @@ app.get('/ships', async function (req, res) {
|
||||||
|
|
||||||
app.get('/ships/*', async function (req, res) {
|
app.get('/ships/*', async function (req, res) {
|
||||||
const list = await head('/var/gopher/listing.gophermap')
|
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 description = bufferFile('/var/gopher/' + ship + '/.description') || ''
|
||||||
const license = bufferFile('/var/gopher/' + ship + '/LICENSE') || ''
|
const license = bufferFile('/var/gopher/' + ship + '/LICENSE') || ''
|
||||||
var licenseLabel = ''
|
var licenseLabel = ''
|
||||||
|
|
Loading…
Reference in New Issue