diff --git a/applications/tempfiles/index.js b/applications/tempfiles/index.js index 267d375..6d39ff7 100644 --- a/applications/tempfiles/index.js +++ b/applications/tempfiles/index.js @@ -167,7 +167,7 @@ async function init () { // Simple URL validator try { let a = new URL(url) - if (a.protocol.indexOf('http') !== 0 || a.protocol.indexOf('ftp') !== -1) { + if (a.protocol.indexOf('http') !== 0 && a.protocol.indexOf('ftp') !== -1) { throw new Error('Unsupported protocol') } } catch (e) { @@ -200,6 +200,10 @@ async function init () { res.send(resp) }) + router.get('/shorten', (req, res) => { + res.send('

Basic URL Shortener

') + }) + router.get('/shorten/:hash', async (req, res) => { let hash = req.params.hash let db = await dbPromise @@ -208,10 +212,6 @@ async function init () { res.redirect(get.url) }) - router.get('/shorten', (req, res) => { - res.send('

Basic URL Shortener

') - }) - return router }