Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't paste XML into chats #9104

Closed
ChristophWurst opened this issue Mar 20, 2023 · 4 comments · Fixed by nextcloud-libraries/nextcloud-vue#3915
Closed

Can't paste XML into chats #9104

ChristophWurst opened this issue Mar 20, 2023 · 4 comments · Fixed by nextcloud-libraries/nextcloud-vue#3915
Assignees
Milestone

Comments

@ChristophWurst
Copy link
Member

ChristophWurst commented Mar 20, 2023

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Open a convo
  2. Paste <?xml version="1.0" encoding="utf-8"?> <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> <s:exception>Sabre\Xml\ParseException</s:exception> <s:message>The input element to parse is empty. Do not attempt to parse</s:message> </d:error>

Expected behaviour

See <?xml version="1.0" encoding="utf-8"?> <d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"> <s:exception>Sabre\Xml\ParseException</s:exception> <s:message>The input element to parse is empty. Do not attempt to parse</s:message> </d:error>

Actual behaviour

See Sabre\Xml\ParseException The input element to parse is empty. Do not attempt to parse

Talk app

Talk app version: (see apps admin page: /index.php/settings/apps)

Custom Signaling server configured: yes/no and version (see additional admin settings: /index.php/index.php/settings/admin/talk#signaling_server)

Custom TURN server configured: yes/no (see additional admin settings: /index.php/settings/admin/talk#turn_server)

Custom STUN server configured: yes/no (see additional admin settings: /index.php/settings/admin/talk#stun_server)

Browser

Microphone available: yes/no

Camera available: yes/no

Operating system: Windows/Ubuntu/...

Browser name: Firefox/Chrome/...

Browser version: 85/96/...

Browser log

``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```

Server configuration

Operating system: Ubuntu/RedHat/...

Web server: Apache/Nginx

Database: MySQL/Maria/SQLite/PostgreSQL

PHP version: 7.4/8.0/8.1

Nextcloud Version: (see admin page)

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your server installation folder

Nextcloud configuration:

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your Nextcloud installation folder

Server log (data/nextcloud.log)

Insert your server log here
@nickvergessen
Copy link
Member

Also happens on master... a regression from your fix/attempt @Antreesy ?

@Antreesy
Copy link
Contributor

Antreesy commented Mar 20, 2023

Also happens on master... a regression from your fix/attempt @Antreesy ?

Still a nextcloud-vue component problem, mentioned here: nextcloud-libraries/nextcloud-vue#3264

@nickvergessen
Copy link
Member

Yes, but the workaround we had does not apply for this case

@nickvergessen
Copy link
Member

I managed to be able to post again with a patch in the vue library like the following:

diff --git a/src/components/NcRichContenteditable/NcRichContenteditable.vue b/src/components/NcRichContenteditable/NcRichContenteditable.vue
index 33744518..dee94a77 100644
--- a/src/components/NcRichContenteditable/NcRichContenteditable.vue
+++ b/src/components/NcRichContenteditable/NcRichContenteditable.vue
@@ -153,6 +153,7 @@ import { searchProvider, getLinkWithPicker } from '../NcRichText/index.js'
 import Tribute from 'tributejs/dist/tribute.esm.js'
 import debounce from 'debounce'
 import stringLength from 'string-length'
+import escapeHtml from 'escape-html'
 
 export default {
 	name: 'NcRichContenteditable',
@@ -482,12 +483,13 @@ export default {
 				return
 			}
 
-			const html = clipboardData.getData('text')
+			const html = escapeHtml(clipboardData.getData('text'))
 			const selection = window.getSelection()
 
 			// If no selection, replace the whole data
 			if (!selection.rangeCount) {
-				this.updateValue(html)
+				const div = document.createElement('div').innerText = escapeHtml(html)
+				this.updateValue(div.innerHTML)
 			}
 
 			// Generate text and insert

But inside the input it looks "broken" but submitting it never the less will print it as expected:
Bildschirmfoto vom 2023-03-23 10-52-10
Bildschirmfoto vom 2023-03-23 10-52-15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment