Copied URL results in "missing or malformed jwt" #3224
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
Vikunja API Version
Browser and version
Firefox 110.0.1 (64-Bit) / Windows 11
Can you reproduce the bug on the Vikunja demo site?
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
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:
- 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
- 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
- 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.
@dpschen 😆 Nasty typo
If the URL doesn't work as a limit of the API, would it be best to just not include the URL as a comment? Perhaps don't include a comment by default when including an attachment, or just say something like "attached 'image.png'" by default?
Just ran into this today and it's slightly awkward as a user...
No due date set.
No dependencies set.
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?