From 34604c7d45bd87ed16fc1dc425497fc4e6e1f950 Mon Sep 17 00:00:00 2001 From: Awakened-Redstone <40528665+Awakened-Redstone@users.noreply.github.com> Date: Wed, 8 Jan 2025 20:25:12 -0300 Subject: [PATCH] fix: Properly handle empty version list on `version/latest` --- apps/frontend/src/pages/[type]/[id]/version/[version].vue | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/frontend/src/pages/[type]/[id]/version/[version].vue b/apps/frontend/src/pages/[type]/[id]/version/[version].vue index f03723a58..de17bcde5 100644 --- a/apps/frontend/src/pages/[type]/[id]/version/[version].vue +++ b/apps/frontend/src/pages/[type]/[id]/version/[version].vue @@ -821,6 +821,13 @@ export default defineNuxtComponent({ if (route.query.version) { versionList = versionList.filter((x) => x.game_versions.includes(route.query.version)); } + if (versionList.length === 0) { + throw createError({ + fatal: true, + statusCode: 404, + message: "No version matches the filters", + }); + } version = versionList.reduce((a, b) => (a.date_published > b.date_published ? a : b)); } else { version = props.versions.find((x) => x.id === route.params.version);