CollaboraOnline / online

Collabora Online is a collaborative online office suite based on LibreOffice technology. This is also the source for the Collabora Office apps for iOS and Android.
https://collaboraonline.com
Other
1.87k stars 710 forks source link

clipboard: copy paste between documents doesn't work #10173

Open eszkadev opened 1 month ago

eszkadev commented 1 month ago

Describe the Bug

Problem with copy from one document instance and paste to the another one.

Steps to Reproduce

broken-save.odt

  1. Use two browsers (I used Firefox and Chrome on linux)
  2. Open attached document in both
  3. Copy shape from one, try to paste in the second

Expected Behavior

Shape is pasted correctly.

Actual Behavior

Shape is not pasted. Browser logs:

Paste
global.js:562 Transfer between servers
    "http://xxxxxxx:9980/cool/clipboard?WOPISrc=http%3A%2F%2Fxxxx%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2Fyyyyyyy&ServerId=3c938e5a&ViewId=5&Tag=dc4f9dd43342b329" vs. 
    "/cool/clipboard?WOPISrc=http%3A%2F%2Fxxxxxx%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2Fyyyyyyy&ServerId=3c938e5a&ViewId=4&Tag=c1b6e7c85095a7bf"
global.js:562 DownloadProgress.show
...
{"id":"progress","type":"progressbar","value":100,"maxValue":100}} 
global.js:562 1728025116011 INCOMING: jsdialog: {"id":"snackbar","jsontype":"dialog","type":"snackbar","action":"close"} 
global.js:562 up-load done, now paste
global.js:562 1728025116012 OUTGOING: uno .uno:Paste 

More interesting is core log with exception:

warn:xmloff:21273:21254:xmloff/source/text/XMLTextListAutoStylePool.cxx:163: getStyleFamilies() from XModel failed for export!
warn:xmloff:21273:21254:xmloff/source/style/impastpl.cxx:368: Adding duplicate family graphic with mismatching mapper ! P25SvXMLExportPropertyMapper 28XMLShapeExportPropertyMapper
warn:xmloff:21273:21254:xmloff/source/style/impastpl.cxx:368: Adding duplicate family presentation with mismatching mapper ! P25SvXMLExportPropertyMapper 28XMLShapeExportPropertyMapper
warn:legacy.osl:21273:21254:xmloff/source/style/xmlexppr.cxx:856: special item not handled in xml export
warn:xmloff:21273:21254:xmloff/source/core/xmlerror.cxx:163: An error or a warning has occurred during XML import/export!
Error-Id: 0x60040004
    Flags: 6 ERROR SEVERE
    Class: 4 API
    Number: 4
Parameters:
Exception-Message: com.sun.star.lang.IllegalArgumentException: "at /media/dev/co-24.04/workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/lang/IllegalArgumentException.hdl:19"

warn:legacy.osl:21273:21254:sax/source/expatwrap/saxwriter.cxx:136: cached Sequence not written
warn:legacy.osl:21273:21254:sfx2/source/doc/sfxbasemodel.cxx:3022: SfxBaseModel::IsInitialized: this should have been caught earlier!
warn:xmloff.core:21273:21254:xmloff/source/core/xmlimp.cxx:949: DBG_UNHANDLED_EXCEPTION in setTargetDocument exception: com.sun.star.lang.NotInitializedException message: "at /media/dev/co-24.04/workdir/UnoApiHeadersTarget/udkapi/normal/com/sun/star/lang/NotInitializedException.hdl:24" context: SvxUnoDrawingModel
warn:svx:21273:21254:svx/source/xml/xmlexport.cxx:216: DBG_UNHANDLED_EXCEPTION in SvxDrawingLayerImport exception: com.sun.star.xml.sax.SAXParseException message: "[ line 2]: Couldn't find end of Start Tag document
 at /media/dev/co-24.04/workdir/UnoApiHeadersTarget/offapi/normal/com/sun/star/xml/sax/SAXParseException.hdl:26"
    wrapped:  PublicId:  SystemId:  LineNumber: 2 ColumnNumber: 2010

Additional Context

I used COOL inside Nextcloud

eszkadev commented 1 month ago

https://github.com/CollaboraOnline/online/pull/10160 didn't show the warning in this case. cc: @vmiklos

vmiklos commented 1 month ago

Did you use the paste button to paste or Ctrl-V? The Ctrl-V case is good enough (we have the magic security context) and there is no reason to try the new async clipboard, so there we only pick that codepath if pasting the old way fails. This is in contrast to the paste button or copy, where the new async clipboard has advantages. The above PR only modifies the copy behavior; if there is a need something similar can be done for the "paste with button" case.

And of course the actual problem is why paste fails, that's a problem to be investigated on its own. :-) Thanks.

Edit: maybe clarify both sides: how do you copy (keyboard vs notebookbar vs context menu) and how do you paste.

eszkadev commented 1 month ago

I always used keyboard: ctrl+c, ctrl+v

vmiklos commented 1 month ago

Hm, interesting. I think I tried to follow your steps:

1) Disable SSL in coolwsd.xml. 2) Load your bugdoc into COOL, using an actual IP address (not localhost). 3) Select the only shape in the document. 4) Press Ctrl-C

In both Chrome and Firefox I get output like this (screenshot is from Firefox):

image

Most probably there is some detail that I miss. :-)