'Task Detail' page tries to render non-existent tasks #2036

Open
opened 2023-03-30 12:22:12 +00:00 by dpschen · 2 comments
Member

Description

  1. Invent a large numeric id e.g. 63653
  2. Use that id to open a task detail page: https://try.vikunja.io/tasks/63653

Expected result

Actual result

See Screenshot below

Vikunja Frontend Version

0.20.5+115-739fe0caa1

Vikunja API Version

v0.20.4+40-5114f53307

Browser and version

Brave is up to date Version 1.49.132 Chromium: 111.0.5563.147 (Official Build) (x86_64)

Can you reproduce the bug on the Vikunja demo site?

Yes

Screenshots

image

### Description 1) Invent a large numeric id e.g. `63653` 2) Use that id to open a task detail page: https://try.vikunja.io/tasks/63653 ## Expected result - Either normal 'not found' page (like https://try.vikunja.io/this-page-doesn-exist) or - a 'task not found' page. ## Actual result See Screenshot below ### Vikunja Frontend Version 0.20.5+115-739fe0caa1 ### Vikunja API Version v0.20.4+40-5114f53307 ### Browser and version Brave is up to date Version 1.49.132 Chromium: 111.0.5563.147 (Official Build) (x86_64) ### Can you reproduce the bug on the Vikunja demo site? Yes ### Screenshots ![image](/attachments/cbb0551b-3943-4357-b73f-466d872cd721)
dpschen added the
kind/bug
label 2023-03-30 12:22:12 +00:00
Owner

I had a stab at this and while it's quite easy to catch a 404 response from the api and replace the currently active view with a 404 that will reset the route to the base url again, which looks kind of confusing. The solution I could think of would be to compute the current view in the App.vue component and then store a flag in pina to show the 404 component when it is set. That sounds pretty hacky to me though, there's got to be another way?

I had a stab at this and while it's quite easy to catch a 404 response from the api and replace the currently active view with a 404 that will reset the route to the base url again, which looks kind of confusing. The solution I could think of would be to compute the current view in the `App.vue` component and then store a flag in pina to show the 404 component when it is set. That sounds pretty hacky to me though, there's got to be another way?
Owner

Here's what I tried so far:

diff --git a/src/views/tasks/TaskDetailView.vue b/src/views/tasks/TaskDetailView.vue
index e891869d..c775fd7a 100644
--- a/src/views/tasks/TaskDetailView.vue
+++ b/src/views/tasks/TaskDetailView.vue
@@ -587,6 +587,10 @@ watch(taskId, async (id) => {
                attachmentStore.set(task.attachments)
                taskColor.value = task.hexColor
                setActiveFields()
+       } catch(e) {
+               if (e.response.status === 404) {
+                       router.replace({name: 'not-found'})
+               }
        } finally {
                await nextTick()
                scrollToHeading()
Here's what I tried so far: ```diff diff --git a/src/views/tasks/TaskDetailView.vue b/src/views/tasks/TaskDetailView.vue index e891869d..c775fd7a 100644 --- a/src/views/tasks/TaskDetailView.vue +++ b/src/views/tasks/TaskDetailView.vue @@ -587,6 +587,10 @@ watch(taskId, async (id) => { attachmentStore.set(task.attachments) taskColor.value = task.hexColor setActiveFields() + } catch(e) { + if (e.response.status === 404) { + router.replace({name: 'not-found'}) + } } finally { await nextTick() scrollToHeading()
konrad added the
confirmed
label 2023-10-30 13:43:23 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: vikunja/vikunja#2036
No description provided.