From 9bac78e0de1cd7a5602dfd11dc730915d2bb5b29 Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Thu, 6 Oct 2022 18:41:31 +0200 Subject: [PATCH] fix(nc-gui): redirect to 404 page if invalid viewid is requested --- packages/nc-gui/pages/[projectType]/form/[viewId].vue | 5 +++++ packages/nc-gui/pages/error/404.vue | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/nc-gui/pages/[projectType]/form/[viewId].vue b/packages/nc-gui/pages/[projectType]/form/[viewId].vue index 90cd2f1027..2e61ec8255 100644 --- a/packages/nc-gui/pages/[projectType]/form/[viewId].vue +++ b/packages/nc-gui/pages/[projectType]/form/[viewId].vue @@ -4,8 +4,10 @@ import { IsPublicInj, MetaInj, ReloadViewDataHookInj, + createError, createEventHook, definePageMeta, + navigateTo, provide, reactive, ref, @@ -37,6 +39,9 @@ if (!notFound.value) { provide(IsFormInj, ref(true)) useProvideSmartsheetStore(sharedView, meta, true) +} else { + navigateTo('/error/404') + throw createError({ statusCode: 404, statusMessage: 'Page Not Found' }) } const form = reactive({ diff --git a/packages/nc-gui/pages/error/404.vue b/packages/nc-gui/pages/error/404.vue index 0948eb7d08..d30d9273e6 100644 --- a/packages/nc-gui/pages/error/404.vue +++ b/packages/nc-gui/pages/error/404.vue @@ -8,8 +8,8 @@ definePageMeta({