From 5c0a7722a4f6b4bf760b7b1da9b2dd5d77797269 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Fri, 8 Nov 2019 11:58:58 +0000 Subject: [PATCH] Disallow navigating to non-existing routes --- client/js/router.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/js/router.js b/client/js/router.js index 28456a54..76ca05a8 100644 --- a/client/js/router.js +++ b/client/js/router.js @@ -34,6 +34,12 @@ const router = new VueRouter({ }); router.beforeEach((to, from, next) => { + // Disallow navigating to non-existing routes + if (!to.matched.length) { + next(false); + return; + } + // Handle closing image viewer with the browser back button if (!router.app.$refs.app) { next();