Bug 145875 - Insert section dialog opened when pasting image from Firefox in Win (paste special is okay)
Summary: Insert section dialog opened when pasting image from Firefox in Win (paste sp...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.0 target:7.3.5
Keywords:
Depends on:
Blocks: Paste Images
  Show dependency treegraph
 
Reported: 2021-11-24 16:29 UTC by Regis Perdreau
Modified: 2022-05-30 18:59 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
Clipboard data (349.95 KB, application/octet-stream)
2021-11-25 07:13 UTC, Aron Budea
Details
Clipboard data from Firefox Windows (1.56 MB, application/octet-stream)
2021-11-30 11:23 UTC, Regis Perdreau
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regis Perdreau 2021-11-24 16:29:09 UTC
Description:
If you copy / paste a picture from Firefox when URL picture has parenthesis,  unexpectedly the "insert section" dialog is opened.

Steps to Reproduce:
1.Open Firefox, on the wikipedia.org main page https://en.wikipedia.org/wiki/Main_Page
2.Locate a picture linked with a link which has parenthesis inside... example :https://en.wikipedia.org/wiki/File:Witi_Ihimaera_(cropped).jpg
3. With the right click open menu and do "copy picture"


3.Go to LibreOffice (Windows), open a Writer document,  paste picture with Ctrl-V for example
4. the "insert section" dialog is opened instead the paste action.

Actual Results:
Insert Section dialog is opened.

Expected Results:
Picture is pasted


Reproducible: Always


User Profile Reset: No



Additional Info:
Windows version only. 

tested on :

Version: 7.0.7.0.M7 (x64)
Build ID: 28389a78c38535f0b4229ebc43797bd90d7a15a2
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); Langue IHM : fr-FR
Calc: CL

Version: 7.2.2.2 (x64) / LibreOffice Community
Build ID: 02b2acce88a210515b4a5bb2e46cbfb63fe97d56
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: fr-FR (fr_FR); UI: fr-FR
Calc: CL
Comment 1 Regis Perdreau 2021-11-24 16:38:34 UTC
Firefox version is 94.0.2 (64 bits)

Important : paste is ok with Chrome Version 96.0.4664.45  (64 bits)
Comment 2 Aron Budea 2021-11-25 00:33:37 UTC
Confirmed using LO Version: 7.3.0.0.alpha1+ (a0a38b88dc3a61d212d784f41a27f97d9c2d7f32), 3.3.0 / Windows.

When looking at the clipboard content using Clipboard Inspector [1], the immediate, and perhaps single difference between Windows and Linux (in Linux there's no problem) is that in Windows the <img> element in the text/html content is enclosed as such:

<html><body>
<!--StartFragment-->
<img ...>
<!--EndFragment-->
</body>
</html>

In Linux there's only a <img ...> element.

Interesgintly when pasting via Paste Special, any of the following choices paste the image:
- Stripped HyperText Markup Language (Simple HTML),
- HTML format without comments,
- Bitmap Image (BMP).

[1] https://evercoder.github.io/clipboard-inspector/
Comment 3 Mike Kaganski 2021-11-25 06:37:05 UTC
Unfortunately, I cannot repro using Version: 7.2.3.2 (x64) / LibreOffice Community
Build ID: d166454616c1632304285822f9c83ce2e660fd92
CPU threads: 12; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: threaded,

neither with Version: 7.3.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: b7a46259eba35257291fe00851252c18ffb4fc90
CPU threads: 12; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: fr-FR (ru_RU); UI: en-US
Calc: CL

and Firefox 94.0.2 (64-bit).

Pasting image from the Wikimedia page linked from comment 0 (using Ctrl+V) copied using "Copy Image" context menu (is that the correct menu item?) just inserts the image normally.

I don't know what might be the difference - is that UI language of LibreOffice? Settings of Firefox? Localized version of Windows? its installed updates?

Anyway, it would possibly help if you prepare a clipboard snapshot - using NirSoft's Inside Clipboard [1]. Attaching a .Clp file created by the tool here could help to eliminate some of unknowns from the equation. (Please check locally, that the .Clp file, when loaded back after changing clipboard content, does cause the same problem pasting into Writer.)

[1] https://www.nirsoft.net/utils/inside_clipboard.html
Comment 4 Aron Budea 2021-11-25 07:13:30 UTC
Created attachment 176486 [details]
Clipboard data

Here's a .clp file with clipboard data I can reproduce the bug with.
Comment 5 Mike Kaganski 2021-11-25 07:35:17 UTC
(In reply to Aron Budea from comment #4)

Thanks a lot - repro!
Comment 6 Regis Perdreau 2021-11-30 11:23:49 UTC
Created attachment 176591 [details]
Clipboard data from Firefox Windows

Here is clipboard data from Firefox 94.0.2 (64 bits)
Comment 7 Aron Budea 2022-02-02 07:25:08 UTC
This should be fixed now as Luboš added WebP support in bug 114532.

I'm not sure if the insert section dialog can still be triggered by pasting unexpected content, as Mike has also added a couple of changes, let's close this for now.
Comment 8 Commit Notification 2022-05-27 18:33:08 UTC
Szymon Kłos committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0599a73c3c2bffdbfa4e695e2d694f1947215a07

tdf#145875 don't open Insert section dialog when pasting image

It will be available in 7.4.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 9 Commit Notification 2022-05-30 18:59:05 UTC
Szymon Kłos committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/daafc32c5625757091e7cf80711a18639bd36bf0

tdf#145875 don't open Insert section dialog when pasting image

It will be available in 7.3.5.

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

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