Copy URL of an attachment give Error #1973

Closed
opened 2022-08-31 06:16:45 +00:00 by Bouni · 19 comments

Version information:

Frontend Version: 0.19.1
API Version: v0.19.2
Browser and OS Version: Firefox 104.0 / Windows 10

Steps to reproduce:

  1. Upload a .jpg as attachment
  2. Click the "Copy URL" link

Expected behavior:

Copy the picture URL into the clipboard

Actual behavior:

Vikunja just shows an Error

Checklist:

  • I have provided all required information
  • I am using the latest release or the latest unstable build
  • I was able to reproduce the bug on try

I was not able to test on try.vikunja.io as the uploads do not work there.

<!-- Please fill out this issue template to report a bug. If you want to propose a new feature, please open a discussion thread in the forum: https://community.vikunja.io --> **Version information:** Frontend Version: 0.19.1 API Version: v0.19.2 Browser and OS Version: Firefox 104.0 / Windows 10 **Steps to reproduce:** <!-- Add clear steps to reproduce the bug. Provide screenshots where applicable. --> 1. Upload a .jpg as attachment 2. Click the "Copy URL" link **Expected behavior:** <!-- Describe what happened. --> Copy the picture URL into the clipboard **Actual behavior:** <!-- Describe what happened instead. --> Vikunja just shows an Error ![](https://kolaente.dev/attachments/80ef104b-afcc-4844-8a94-07ac81993c9b) **Checklist:** * [x] I have provided all required information * [x] I am using the latest release or the latest unstable build * [ ] I was able to reproduce the bug on [try](https://try.vikunja.io) I was not able to test on try.vikunja.io as the uploads do not work there.
Owner

I was not able to reproduce this on try. Upload worked fine, as did copying the url.

Are there any other errors in the browser console when you try to copy the url?

I was not able to reproduce this on try. Upload worked fine, as did copying the url. Are there any other errors in the browser console when you try to copy the url?
Author

I'm able to upload and copy the URL on try.vikunja.io now as well but the problem still exists on my instance.

I see no error in the console though.

I'm able to upload and copy the URL on try.vikunja.io now as well but the problem still exists on my instance. I see no error in the console though.
Owner

@Bouni Are you running unstable?

@Bouni Are you running unstable?
Author

All the other functions (download, delete, preview) work as expected.

My workaround for now is to preview and right click -> copy image url.

All the other functions (download, delete, preview) work as expected. My workaround for now is to preview and right click -> copy image url.
Author

No, I run via docker-compose: image: vikunja/frontend

No, I run via docker-compose: `image: vikunja/frontend`
Author

Is it maybe related to the copy to clipboard functionality!?

Is there another place where vikunja utilized this function so that I can verify my guess?

Is it maybe related to the copy to clipboard functionality!? Is there another place where vikunja utilized this function so that I can verify my guess?
Owner

Is there another place where vikunja utilized this function so that I can verify my guess?

Copying a share link uses the same code.

> Is there another place where vikunja utilized this function so that I can verify my guess? Copying a share link uses the same code.
Author

The exact same problem happens!

image

The exact same problem happens! ![image](/attachments/3b83c161-a58f-48c9-b41d-46e7735c148d)
Author

The only difference I can spot between my instance and try is that my instance runs locally without https where try obviously uses https ...

The only difference I can spot between my instance and try is that my instance runs locally without https where try obviously uses https ...
Owner

If it works on try but not in the release that means it's already been fixed in the development branch. I'll check if that's what has happened here.

If it works on try but not in the release that means it's already been fixed in the development branch. I'll check if that's what has happened here.
Author

I'm not sure if unstable = dev branch but I tested with image: vikunja/frontend:unstable and the problem is the same.

I'm not sure if unstable = dev branch but I tested with `image: vikunja/frontend:unstable` and the problem is the same.
Owner

Unstable is the dev branch. Everything is explained here: https://vikunja.io/docs/versions/

Unstable is the dev branch. Everything is explained here: https://vikunja.io/docs/versions/

BTW. I am also running locally without HTTPS.

BTW. I am also running locally without HTTPS.
Owner

@stepanov1975 What browser and os are you using?

@stepanov1975 What browser and os are you using?

Windows 10 + Chrome Version 104.0.5112.102

Windows 10 + Chrome Version 104.0.5112.102
Owner

As it turns out, the js clipboard api we're using to put the url into the clipboard is only available in "secure contexts". This means you'll need to access Vikunja via https or copying won't work.

It looks like this is nothing Vikunja can fix, therefore I'll close this issue.

As it turns out, [the js clipboard api](https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard#using_the_clipboard_api) we're using to put the url into the clipboard is only available in "secure contexts". This means you'll need to access Vikunja via https or copying won't work. It looks like this is nothing Vikunja can fix, therefore I'll close this issue.
Member

I created a fallback that uses the deprecated document.execCommand('copy'): vikunja/frontend#2343

Since it's currently widely supported I guess that's a fine compromise.

I created a fallback that uses the deprecated `document.execCommand('copy')`: https://kolaente.dev/vikunja/frontend/pulls/2343 Since it's currently widely supported I guess that's a fine compromise.

I created a fallback that uses the deprecated document.execCommand('copy'): vikunja/frontend#2343

Since it's currently widely supported I guess that's a fine compromise.

THanks!

> I created a fallback that uses the deprecated `document.execCommand('copy')`: https://kolaente.dev/vikunja/frontend/pulls/2343 > > Since it's currently widely supported I guess that's a fine compromise. THanks!
Sign in to join this conversation.
No Milestone
No Assignees
4 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#1973
No description provided.