Bug 438426

Summary: Issue with copy-paste image from Chromium based browser (Chrome, Edge) on Nightly Build
Product: [Applications] krita Reporter: idaeroace
Component: GeneralAssignee: amyspark <amy>
Status: RESOLVED FIXED    
Severity: normal CC: ahab.greybeard, alvin, amy, dimula73, halla, knowzero, korotkih.00, marthe.skaara2, raincolee
Priority: NOR Keywords: regression
Version: nightly build (please specify the git hash!)   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Bug Depends on:    
Bug Blocks: 447428    
Attachments: The error shown when paste image
Krita System Infomation
Krita Usage Log

Description idaeroace 2021-06-10 15:37:41 UTC
Created attachment 139206 [details]
The error shown when paste image

SUMMARY
I'm using the latest June 10 Nightly build (c4e3b84904)

I (and 2 other users on krita-artist) can't copy-paste any image from Chromium based browser (Chrome, Edge, Vivaldi, Brave) into Krita. Copy-paste from other browser like Mozila Firefox and Palemoon works fine. Also still works fine on 4.4.3

Last time I'm able to copy-paste from Edge was on June 2, using May 28 Nightly build (56d09e2386). But now, even if I try using older nightly version, it's also not working.

STEPS TO REPRODUCE
1. Copy any image using Edge or Chrome
2. Paste in Krita (Ctrl+V or using Edit menu)
3. Error pop up, says "Could not download : Protocol "" is unknown"

ANOTHER RELATED ISSUE
And related another issue. Still about copying image from Chromium. Using Edit - Paste as Reference Image is working fine. But Ctrl+V then Insert as Reference Image give the same error. 

Here is the issue. After I use Edit - Paste as Reference Image twice, using any choice on Ctrl+V will give same error, but it create Reference Image. Even when I choose "Cancel"

STEPS TO REPRODUCE
1. Copy any image using Edge or Chrome
2. Go to Edit menu, Paste as Reference Image. Do this twice
3. Press Ctrl+V, and choose any option
4. Error pop up, says "Could not download : Protocol "" is unknown", but new Reference Image will be created, even if choose Cancel
Comment 1 idaeroace 2021-06-10 15:40:45 UTC
Created attachment 139207 [details]
Krita System Infomation
Comment 2 idaeroace 2021-06-10 15:45:26 UTC
Created attachment 139208 [details]
Krita Usage Log

Inside rar because it's too large
Comment 3 Ahab Greybeard 2021-06-10 16:26:45 UTC
This was first reported at: https://krita-artists.org/t/cant-copy-paste-image-from-chromium-chrome-and-edge-to-krita-nightly-build/24960

I can confirm this for the Jun 10 5.0.0-prealpha git c4e3b84904) portable .zip on Windows 10.
Tested with Palemoon and Edge. Palemoon gave no problems but Edge was as described in the report.

Further, for 'Another Related Issue', I found that Step 2, wasn't needed. If I pasted with Ctrl+V and chose Insert as New Layer, it pasted as a reference image after I Cancelled the error message.

This problem does not happen for the 4.4.3 installed version with the Edge browser, hence regression.
Comment 4 Dmitry Kazakov 2021-07-22 05:52:39 UTC
Git commit 5cc93f9c947b27dd1c855449d0053d3a0321a93d by Dmitry Kazakov.
Committed on 22/07/2021 at 05:52.
Pushed by dkazakov into branch 'master'.

Fix loading of remote documents dropped to the canvas

The temporary file should still be alive when we read from it
some time later.

M  +5    -2    libs/ui/utils/KisClipboardUtil.cpp

https://invent.kde.org/graphics/krita/commit/5cc93f9c947b27dd1c855449d0053d3a0321a93d
Comment 5 Dmitry Kazakov 2021-07-30 05:14:52 UTC
The issue is reported to Chrome:

https://bugs.chromium.org/p/chromium/issues/detail?id=1231533

Though we should probably reconsider our strategy on download/use-paste decision making.
Comment 6 Alvin Wong 2021-08-01 07:09:56 UTC
I think it shouldn't just silently decide to download from the URL. Maybe showing a message box with the URL and a clipboard image preview, with the options to choose between download or using the clipboard image directly would be better?
Comment 7 Halla Rempt 2021-08-16 10:51:02 UTC
*** Bug 440944 has been marked as a duplicate of this bug. ***
Comment 8 Yu-Hsuan Lai 2021-09-04 07:03:52 UTC
Similar issue for me with 5.0.0-beta1. It seems to always try to download from the URL.
Comment 9 Bug Janitor Service 2021-11-25 14:12:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1177
Comment 10 Bug Janitor Service 2021-11-29 02:53:22 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/krita/-/merge_requests/1185
Comment 11 amyspark 2021-11-29 09:25:16 UTC
Git commit 4c84bd46409febdb0a411e056dfdd6fa1af80cc4 by L. E. Segovia.
Committed on 29/11/2021 at 02:51.
Pushed by dkazakov into branch 'krita/5.0'.

Fix failed cancellation of paste events

M  +11   -9    libs/ui/kis_clipboard.cc

https://invent.kde.org/graphics/krita/commit/4c84bd46409febdb0a411e056dfdd6fa1af80cc4
Comment 12 Dmitry Kazakov 2021-11-29 09:27:08 UTC
Git commit d40853c0bc7eee4cfa7303e2892a1dac171d08b1 by Dmitry Kazakov, on behalf of L. E. Segovia.
Committed on 29/11/2021 at 09:26.
Pushed by dkazakov into branch 'master'.

Fix failed cancellation of paste events

M  +11   -9    libs/ui/kis_clipboard.cc

https://invent.kde.org/graphics/krita/commit/d40853c0bc7eee4cfa7303e2892a1dac171d08b1
Comment 13 amyspark 2022-02-02 02:45:28 UTC
Git commit 1fd0a667af0ac32916fc8a8af5daa79c5181302b by L. E. Segovia.
Committed on 31/01/2022 at 20:27.
Pushed by lsegovia into branch 'master'.

Prefer clipboard bitmap to remote URL for drag-and-drop

M  +11   -12   libs/ui/kis_clipboard.cc
M  +34   -7    libs/ui/utils/KisClipboardUtil.cpp

https://invent.kde.org/graphics/krita/commit/1fd0a667af0ac32916fc8a8af5daa79c5181302b
Comment 14 amyspark 2022-02-02 02:45:37 UTC
Git commit f948f3dfb0d2b583f9b12049f2cf5f27cc0cd922 by L. E. Segovia.
Committed on 31/01/2022 at 20:31.
Pushed by lsegovia into branch 'master'.

Implement user-consentable prioritization of image formats

This adds multiple new dialogues:

- If the application provides multiple formats for a drop event, e.g.
  Firefox supplies a clipboard bitmap and a local file copy, Krita will
  ask the user which one they prefer.
- If the selected format involves accessing the Internet, further
  consent will be asked, and then a simple progress dialog will report
  the download's progress and allow cancelling the download.

This commit also affords the chance to reimplement the Missing Color
Profile dialog with a .ui file, and refactor the KisClipboard usage.

M  +4    -0    libs/ui/CMakeLists.txt
M  +18   -0    libs/ui/KisReferenceImage.cpp
M  +11   -3    libs/ui/KisReferenceImage.h
M  +58   -16   libs/ui/KisRemoteFileFetcher.cpp
M  +4    -11   libs/ui/KisRemoteFileFetcher.h
M  +94   -130  libs/ui/KisView.cpp
A  +58   -0    libs/ui/dialogs/kis_dlg_paste_format.cpp     [License: LGPL(v2.0+)]
A  +37   -0    libs/ui/dialogs/kis_dlg_paste_format.h     [License: LGPL(v2.0+)]
A  +152  -0    libs/ui/forms/wdgPasteFormat.ui
M  +160  -45   libs/ui/kis_clipboard.cc
M  +20   -0    libs/ui/kis_clipboard.h
A  +77   -0    libs/ui/widgets/kis_canvas_drop.cpp  *
A  +42   -0    libs/ui/widgets/kis_canvas_drop.h     [License: LGPL(v2.0+)]

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://invent.kde.org/graphics/krita/commit/f948f3dfb0d2b583f9b12049f2cf5f27cc0cd922
Comment 15 amyspark 2022-05-04 22:11:20 UTC
*** Bug 435657 has been marked as a duplicate of this bug. ***
Comment 16 amyspark 2022-05-20 17:26:09 UTC
*** Bug 453917 has been marked as a duplicate of this bug. ***