Bug 73045 - can't paste image from clipboard to Writer (URI format is wrong, with forward slash "/")
Summary: can't paste image from clipboard to Writer (URI format is wrong, with forward...
Status: RESOLVED DUPLICATE of bug 35176
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.2.0.1 rc
Hardware: Other Windows (All)
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-26 10:15 UTC by narayanaras
Modified: 2016-05-17 00:58 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Shows problem in Win 7 Professional (pause video as required) (1.73 MB, video/webm)
2014-01-02 12:17 UTC, narayanaras
Details
The image is LINKED (not INSERTED) (839.29 KB, video/webm)
2014-01-02 12:21 UTC, narayanaras
Details
How the image behaves in Writer (2.60 MB, application/force-download)
2014-01-03 06:27 UTC, narayanaras
Details
How the image behaves in Impress (2.09 MB, video/webm)
2014-01-03 06:35 UTC, narayanaras
Details
Path shows "/", instead of "\" in Windows 7 Professional (28.08 KB, image/png)
2014-01-03 09:10 UTC, narayanaras
Details

Note You need to log in before you can comment on or make changes to this bug.
Description narayanaras 2013-12-26 10:15:55 UTC
I take screenshots using Greenshot.

I can paste the image from clipboard in Impress and Draw. 
But if I paste the clipboard content into Writer, the image is missing: It shows only a placeholder.

I traced the problem: The root cause is that the URI contains three FORWARD slashes, not BACK-slashes as required in Windows. 

Here is a sample URI: file:///C:Users\njaras\AppDataLocal\Temp\gfukOrcd.1lk.png

If I manually correct the slashes, the image gets inserted normally.

Steps to do this:
1. Double-clicking on the placeholder
2. A "Picture" window pops up. Click on its "Picture" tab.
3. In the "Link" section, the URI of the temporary file is listed.
4. Edit the URI and replace /// with \\\
5. Press OK. The image is inserted in the file now.

Conclusion: Both Impress and Draw create the URI correctly.
Please correct the URI format in Writer.
Comment 1 narayanaras 2013-12-26 10:20:20 UTC
Update:

I simply deleted the protocol specifier part at the beginning (file:///).
This was sufficient to correct the problem.

That means the "file:///" is actually redundant, and can be removed altogether.
(There is no need to correct /// to \\\ at all.)
Comment 2 tommy27 2013-12-29 00:05:57 UTC
so do you think that was a LibO bug or an issue about Greenshot or the way you pasted the URI?
Comment 3 retired 2013-12-29 01:01:57 UTC
So where is that faulte URL coming from? Greenshot? I agree with tommy27, that in that case it isn't a LO bug.

Setting to NEEDINFO until more detail is provided.

After providing the requested info, please reset this bug to UNCONFIRMED. Thanks :)
Comment 4 narayanaras 2013-12-29 04:18:00 UTC
Well, I have already stated that the image does get inserted in Impress and Draw with the EXACT SAME steps.

So how do you conclude that the URI may be faulty?

Even assuming that the incoming URI is faulty, How come it can be handled by Impress and Draw; but not by Writer?? Obviously, the logic used in Impress and Draw seems to be more robust, and should be reused in the Writer too.

Also, the code for pasting clipboard contents is different in Writer. WHY?? Shouldn't a common code be reused across all LibreOffice apps?
Comment 5 tommy27 2013-12-29 08:15:51 UTC
I have Greenshot too, so I can test.

please provide complete step-by-step instruction how to reproduce the bug and specifically how do you copy and paste it from Greenshot to Writer.
Comment 6 narayanaras 2013-12-30 05:41:30 UTC
I tried this in PC at home, and found that I am able to paste the image. 

Further-

1. If I try to check the URI in LibreOffice (by double-clicking on the image, and in the dialog box that pops up, clicking on the "Image" tab), I cannot see any URI at all. 
2. I checked the Edit>Links menu option, which is grayed out.

That means the image is fully pasted in the document (and not linked from the temp folder).

*****
In comparison, at work, the placeholder shows the URI in wrong format (as described earlier), and when this format is corrected, the image is LINKED from the temporary folder (I have to break the link by using the Edit>Link menu).

*****
Both PCs are running on 32-bit Windows 7.
But the home PC has Home premium version, and the work PC has Professional version.

I used the same installers to install LibreOffice (4.2.0.1 RC1) and GreenShot (v1.1.7 Build 17) in both PCs. 

I restarted both PCs, and the behavior (good/bad) is consistent in both PCs.
Comment 7 narayanaras 2013-12-30 05:43:13 UTC
p.s. I reflected this bug at GreenShot, but they feel that this may be a bug with LibreOffice, because the URI is correct according to specifications RFC 1738.

(see https://sourceforge.net/p/greenshot/bugs/1600/)
Comment 8 retired 2013-12-31 10:40:55 UTC
Narayanaras: All that's needed is "please provide complete step-by-step instruction how to reproduce the bug and specifically how do you copy and paste it from Greenshot to Writer."

Please provide that info - otherwise it is impossible for tommy27 to try and reproduce.

From your initial description the steps are fuzzy e.g. "1. Double-clicking on the placeholder" in which software?

Maybe a small screencast would be the best way to show what is exactly going on.
Comment 9 narayanaras 2014-01-02 12:17:33 UTC
Created attachment 91413 [details]
Shows problem in Win 7 Professional (pause video as required)

Enclosed in a video that shows the problem.

I have inserted call outs to place a running commentary about what's happening, and what steps I take.

Notice that the link inserted in wrong: It has "File:///" instead of "File:\\\".
As soon as the URI is corrected, the image appears. Note that this image is LINKED (not INSERTED in the document).
Comment 10 narayanaras 2014-01-02 12:21:05 UTC
Created attachment 91414 [details]
The image is LINKED (not INSERTED)

This video shows how the image that appears after correction of link is linked to a TEMPORARY folder. 

Note that if I don't break the link, the image will be lost soon, because the actual image is in a TEMPORARY folder.

In contrast, when I repeat the experiment in Win7 Premium at home, the image is inserted (not LINKED). I don't have to worry about breaking the link to make it permanent.
Comment 11 tommy27 2014-01-02 13:04:01 UTC
I have Greeenshot 1.1.7 buid 17 64-bit version
I use LibO 4.1.4.2 under Win7 Pro 64bit

it's not clear to me from your video how exactly you do the "copy & paste" from Greenshot.

in my PC I select "capture region" in Greenshot then take the screenshot, then a pop-up menu comes out and I can choose among other options "Copy to clipboard".

then I Ctrl+V to paste the captured screenshot in Writer and the image is fully pasted in the document, not linked outside.

I suspect you have a different configuration of Greenshot that automatically saves the "capture region" to a temp folder and this triggers the bug.

can you confirm this? check Greenshot "fast preferences" right clicking on the traybar icon, you should see something like: has Greenshot such "Image destination" (I have Italian UI so translation may differ). Actually I have "select destination dinamically"
Comment 12 narayanaras 2014-01-03 05:02:10 UTC
Yes, GreenShot offers a list of destinations if you select "dynamically".

In my case I have set identical settings for both PCs:
1. Destination (select Preferences > Destination tab) : "Copy to clipboard"
2. Storage location(select Preferences > Output tab): "D:\Data\Downloads" 

So When I capture a screenshot, the image is automatically placed on clipboard.
All I have to do is to switch to the target app (in this case LibreOffice Writer), and press CTRL+V.

As mentioned, I can paste the image in Impress and Draw. But not in Writer.

In fact, I conducted two additional experiments:

Experiment-1:
I opened one odt file and one odp file. Then I took a screenshot and switched to odt first, and pressed CTRL+V. It gave a placeholder. Then I switched to odp and pressed CTRL+V again (that means the clipboard contents are still the same). This time I am seeing the image.

That means there is nothing wrong in the clipboard content.

Experiment-2:
I selected the image in Impress and pressed CTRL+C, switched to Writer and pressed CTRL+V. This time the image is pasted normally.

Again, this means the clipboard contents are OK.
*********
BTW I also observed a strange effect: Both Impress and Draw seem to treat the image differently (as compared to Writer). If I double-click on the pasted image in Impress/Draw, it only allows me to type text (as if the pasted image is a text box). But if I double-click on the corrected image in Writer, a complete "Picture" dialog box opens up, with a lot of tabs (Type/Options/Wrap/ Hyperlink/Picture/Crop/Borders/Background/Macro).

In the experiment-2 above, the image copied from Impress and pasted in Writer behaves as it behaves in Impress (a double-click on it only allows me to type text only; and does not show me "picture" properties).



.
Comment 13 narayanaras 2014-01-03 06:27:37 UTC
Created attachment 91448 [details]
How the image behaves in Writer

The "Image in Writer" video shows that-
1. When pasted, only a placeholder shows up.
2. When it is double-clicked, the "Picture" dialog is triggered.
3. In this dialog, switch to "Picture" tab and correct the URI (from /// to \\\)
4. Now the actual image appears (only LINKED, not INSERTED)
5. A double-click on the image triggers the same "Picture" dialog.

Contrast this with the corresponding video for Impress.
Comment 14 narayanaras 2014-01-03 06:35:12 UTC
Created attachment 91449 [details]
How the image behaves in Impress

How the image behaves in Impress

The first half of this video shows the Writer again (for reference).
In the second half, I switched to Impress and pasted the SAME clipboard contents.

The latter half of the "Image in Impress" video shows that-
1. When pasted, the image shows up.
2. When it is double-clicked, the "Picture" dialog is NOT triggered.
   Instead, I am allowed to type text there.
   (the pasted image behaves like background for this "text box")

Contrast this with the corresponding video for Writer.
Comment 15 tommy27 2014-01-03 07:17:39 UTC
sorry I still not reproduce your issue even on 4.2.0.1rc

Greenshot captures saved to the clipboard can be pasted without any issue in Writer. I do not see that placeholder you talk about.

did you try resetting your user profile?

https://wiki.documentfoundation.org/UserProfile
Comment 16 narayanaras 2014-01-03 08:10:39 UTC
oops- I forgot to mention that part:

Yes, I deleted the "4" folder from this path:
C:\Users\njaras\AppData\Roaming\LibreOffice\4
And then restarted the PC. Yet the problem is still there.
Comment 17 narayanaras 2014-01-03 08:13:34 UTC
BTW as I pointed out, this problem is not there in my home PC (running 32-bit Win 7 Home Premium). So this issue could be specific to a 32-bit Win7 Professional.
Comment 18 tommy27 2014-01-03 08:26:18 UTC
so you are saying that the bug you report affects only a Win7 Pro 32bit PC and doesn't affects a Win7 Home 32bit PC?
Comment 19 narayanaras 2014-01-03 08:53:07 UTC
No my point was that the fact that I am able to paste the image in Win 7 Home Premium, shows that the problem is not universal. So if you are unable to replicate it in another type of OS, I won't be surprised.

So any observation in other types of OSs should NOT lead to a "WorksForMe" closure.
Comment 20 narayanaras 2014-01-03 09:10:46 UTC
Created attachment 91454 [details]
Path shows "/", instead of "\" in Windows 7 Professional

I discovered this by chance: When I hover over a file's thumbnail in the Start Center, the tooltip shows the path of the file with "/", instead of "\" in Windows 7 Professional.

Since the tooltip path is not used anywhere, this won't create any problem. 
But this does prove that in some parts of the code, the wrong type of slashes are used (it is compatible with Linux, but not compatible with Windows file system).

To conclude, by removing the "File:///" part, the problem can be resolved.
(Or change the "File:///" to "File:\\\".)
Comment 21 tommy27 2014-01-03 10:24:51 UTC
(In reply to comment #20)
> Created attachment 91454 [details]
> Path shows "/", instead of "\" in Windows 7 Professional
> 
> I discovered this by chance: When I hover over a file's thumbnail in the
> Start Center, the tooltip shows the path of the file with "/", instead of
> "\" in Windows 7 Professional.

interestingly when I hover on it I don't see the path of the file but just the filename.  tested under LibO 4.2.0.1rc under Win7 Pro 64bit.
Comment 22 Maxim Monastirsky 2014-01-27 21:29:34 UTC

*** This bug has been marked as a duplicate of bug 59236 ***
Comment 23 Luke 2016-05-17 00:58:31 UTC

*** This bug has been marked as a duplicate of bug 35176 ***