I want to add a link to an attachment to the task description.
next I click the copy URL link below the attachment and add a link to the description like this:
When I click that link in the description afterwards, I get a new window with a JSON message:
message "missing or malformed jwt"
Vikunja Frontend Version
0.20.3
Vikunja API Version
v0.20.2
Browser and version
Firefox 110.0.1 (64-Bit) / Windows 11
Can you reproduce the bug on the Vikunja demo site?
Yes
Screenshots
My instance:
Try.vikunja.io
### Description
I want to add a link to an attachment to the task description.
next I click the copy URL link below the attachment and add a link to the description like this:
```
- [Attachment](http://<redacted>/api/v1/tasks/227/attachments/75)
```
When I click that link in the description afterwards, I get a new window with a JSON message:
```
message "missing or malformed jwt"
```
### Vikunja Frontend Version
0.20.3
### Vikunja API Version
v0.20.2
### Browser and version
Firefox 110.0.1 (64-Bit) / Windows 11
### Can you reproduce the bug on the Vikunja demo site?
Yes
### Screenshots
My instance:

Try.vikunja.io



That's a limitation of the api. I think we could solve this by intercepting links to attachments and downloading them as we do when clicking on the download button. We already do something like that for images embedded in the description or comments.
That's a limitation of the api. I think we could solve this by intercepting links to attachments and downloading them as we do when clicking on the download button. We already do something like that for images embedded in the description or comments.
You mean what you do here: https://kolaente.dev/vikunja/frontend/src/branch/main/src/helpers/markdownRenderer.ts#L17-L19
must be also done here: https://kolaente.dev/vikunja/frontend/src/branch/main/src/helpers/markdownRenderer.ts#L33-L35
Right?
I just gave it a try but I don't see how I could achieve this in a .ts file (markdownRenderer.ts).
Looking at components/tasks/partials/attachments.vue I see that there's a @click="viewOrDownload(a)" but thats a .vue file.
So I think I can't send a PR 🤷♂️
But if you fix it I'll look closely at your solution and hopefully learn something new 😅
I just gave it a try but I don't see how I could achieve this in a .ts file (markdownRenderer.ts).
Looking at components/tasks/partials/attachments.vue I see that there's a `@click="viewOrDownload(a)"` but thats a .vue file.
So I think I can't send a PR 🤷♂️
But if you fix it I'll look closely at your solution and hopefully learn something new 😅
In the click event handler, download the attachment and prevent the click action.
The first could be done here as well - just querySelect all link elements in the editor scope and then check if they are linking to an attachment, then add the event handler to it.
The part for adding an event listener to the links is similar to this one here: https://kolaente.dev/vikunja/frontend/src/branch/main/src/components/input/editor.vue#L268-L275 (adding a change handler to the checkboxes to make checklists work).
Basically, this has a few steps:
1. For each link, check if it has a link to an attachment, like here: https://kolaente.dev/vikunja/frontend/src/branch/main/src/helpers/markdownRenderer.ts#L17-L19
2. Then add an event listener to that link so that the click on that link is caught and the attachment is downloaded instead, preventing the actual click. Similar to here: https://kolaente.dev/vikunja/frontend/src/branch/main/src/components/input/editor.vue#L268-L275
3. In the click event handler, download the attachment and prevent the click action.
The first could be done [here](https://kolaente.dev/vikunja/frontend/src/branch/main/src/components/input/editor.vue#L268) as well - just `querySelect` all link elements in the editor scope and then check if they are linking to an attachment, then add the event handler to it.
dpschen
changed title from Copied URL resluts in "missing or malformed jwt" to Copied URL results in "missing or malformed jwt"1 week ago
Description
I want to add a link to an attachment to the task description.
next I click the copy URL link below the attachment and add a link to the description like this:
When I click that link in the description afterwards, I get a new window with a JSON message:
Vikunja Frontend Version
0.20.3
Vikunja API Version
v0.20.2
Browser and version
Firefox 110.0.1 (64-Bit) / Windows 11
Can you reproduce the bug on the Vikunja demo site?
Yes
Screenshots
My instance:
Try.vikunja.io
That's a limitation of the api. I think we could solve this by intercepting links to attachments and downloading them as we do when clicking on the download button. We already do something like that for images embedded in the description or comments.
You mean what you do here: https://kolaente.dev/vikunja/frontend/src/branch/main/src/helpers/markdownRenderer.ts#L17-L19
must be also done here: https://kolaente.dev/vikunja/frontend/src/branch/main/src/helpers/markdownRenderer.ts#L33-L35
Right?
Pretty much, but then also need to add an event handler to the link object so that it will download the attachment when clicking on it.
I just gave it a try but I don't see how I could achieve this in a .ts file (markdownRenderer.ts).
Looking at components/tasks/partials/attachments.vue I see that there's a
@click="viewOrDownload(a)"
but thats a .vue file.So I think I can't send a PR 🤷♂️
But if you fix it I'll look closely at your solution and hopefully learn something new 😅
The part for adding an event listener to the links is similar to this one here: https://kolaente.dev/vikunja/frontend/src/branch/main/src/components/input/editor.vue#L268-L275 (adding a change handler to the checkboxes to make checklists work).
Basically, this has a few steps:
The first could be done here as well - just
querySelect
all link elements in the editor scope and then check if they are linking to an attachment, then add the event handler to it.Copied URL resluts in "missing or malformed jwt"to Copied URL results in "missing or malformed jwt" 1 week ago😉
@dpschen 😆 Nasty typo