Bug 108122 - Copy/paste of mixed content (text and not embedded images) does not paste the images
Summary: Copy/paste of mixed content (text and not embedded images) does not paste the...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.2.5.1 release
Hardware: All Windows (All)
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:6.1.0
Keywords: bibisected, bisected
Depends on:
Blocks: HTML-Export
  Show dependency treegraph
 
Reported: 2017-05-26 13:12 UTC by doithot
Modified: 2018-03-28 20:40 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (77.29 KB, application/odt)
2017-05-26 19:11 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description doithot 2017-05-26 13:12:49 UTC
Description:
When you copy a mixed content (text and images) and then want to paste it in another document the images are not pasted. In fact it looks like the images are not copied. Or probably not even selected with the function ctrl+A  !!!

Steps to Reproduce:
1.Copy a mixed content (texte and images) from a writer document using the usual keyboard key combination ctrl+A and then ctrl+C
2.Paste the copied content in another document, for instance an email you are writing with thunderbird.

Actual Results:  
The texte is pasted but not the images

Expected Results:
All the copied content, texte and images should be pasted


Reproducible: Always

User Profile Reset: No

Additional Info:
It works when not using LibreOffice Writer but MS Office Word :-/

If you use a clipboard viewer, like Free Clipboard Viewer, you can see that the HTML copied from Writer does *not* contain any images, so there is nothing to paste. You can copy a single image from Writer, but not text and image(s) together.

If you want to include part of a document in another document of email it is very painful if you have to then place all the images separately.

It was working properly before.


User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0
Comment 1 Telesto 2017-05-26 19:11:34 UTC
Created attachment 133628 [details]
Example file

Confirming with
Version: 5.5.0.0.alpha0+
Build ID: d57e6cd9dcc96112994ca2b14ac45896e86b26e5
CPU threads: 4; OS: Windows 6.19; UI render: default; 
TinderBox: Win-x86@42, Branch:master, Time: 2017-05-18_22:43:07
Locale: nl-NL (nl_NL); Calc: CL

and with
Version: 5.2.5.0.0+
Build ID: a4d4fbeb623013f6377b30711ceedb38ea4b49f8
CPU Threads: 4; OS Version: Windows 6.2; UI Render: GL; 
TinderBox: Win-x86@62-merge-TDF, Branch:libreoffice-5-2, Time: 2016-12-24_14:43:55
Locale: nl-NL (nl_NL); Calc: CL

but not with
Version: 5.1.0.3
Build ID: 5e3e00a007d9b3b6efb6797a8b8e57b51ab1f737
CPU Threads: 4; OS Version: Windows 6.2; UI Render: default; 
Locale: en-US (nl_NL)
Comment 2 raal 2017-05-29 18:29:22 UTC
This seems to have begun at the below commit.
Adding Cc: to Oliver Specht; Could you possibly take a look at this one? Thanks

5af3f34ff97a3e82648054e4cc5f67f40c39173b is the first bad commit
commit 5af3f34ff97a3e82648054e4cc5f67f40c39173b
Author: Norbert Thiebaud <nthiebaud@gmail.com>
Date:   Sun Mar 27 21:51:16 2016 -0700

    source sha:46fa816aa0a713c54836b9689fa7a1c9ff55ef5a

	author	Oliver Specht <oliver.specht@cib.de>	2016-03-18 14:57:17 (GMT)
committer	Oliver Specht <oliver.specht@cib.de>	2016-03-23 13:57:16 (GMT)
commit	46fa816aa0a713c54836b9689fa7a1c9ff55ef5a (patch)
tree	8dad103eca59e741a51a2b761c9bfd69a24f95fc
parent	f9cf53a082f1d99b313ebd09c8791541859eac40 (diff)
tdf#63211: saving embedded images to HTML optional
This change re-introduces linked images in HTML export
but keeps embedded image export in mailmerge e-Mail function
Comment 3 Aron Budea 2017-05-29 21:08:50 UTC
Apparently the "original" behavior was a partly implemented feature/bugfix (since 4.2, see bug 63211) that had to be partly reverted/worked around with the commit identified by raal.
Removing keyword regression.

The original bugfix:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=5dd1b3da57862a6577717544dde56482add89170
author		Ciorba Edmond <edmond_ciorba@yahoo.com>	2013-07-03 13:14:45 (GMT)
committer	Andras Timar <atimar@suse.com>	2013-07-11 10:36:20 (GMT)

"fdo#63211 - embed images in HTML export."
Comment 4 Miklos Vajna 2018-03-27 12:07:15 UTC
I plan to look at this. The problem seems to be that non-embedded images need a non-empty base URL, but we don't have such during paste.
Comment 5 Miklos Vajna 2018-03-28 13:03:40 UTC
Sounds like this is indeed not a regression. Depending on the application, some (e.g. Thunderbird) started to have images after Edmond's commit, but not others (e.g. Word). Then Oliver's commit made this worse, making the images completely missing, back to how it was initially.

Word emits an HTML fragment like this:

<img width=395 height=262
   src="file:///C:\Users\Miklos\AppData\Local\Temp\msohtmlclip1\01\clip_image002.jpg"
   v:shapes="Picture_x0020_6">

We can do the same, emit references to tempfiles, then not only Thunderbird but more limited HTML parsers like Word will be happy as well.
Comment 6 Commit Notification 2018-03-28 15:55:53 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=6a189b2ac72d5fb83199bdb09e41f7d088440cc9

tdf#108122 HTML export: fix lost images on copy

It will be available in 6.1.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.