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

Pasting an image from a browser to the chat window crashes on send #867

Closed
chmeeedalf opened this issue May 4, 2023 · 4 comments · Fixed by #868
Closed

Pasting an image from a browser to the chat window crashes on send #867

chmeeedalf opened this issue May 4, 2023 · 4 comments · Fixed by #868
Labels
bug/fix Quaternion doesn't work as expected

Comments

@chmeeedalf
Copy link
Contributor

chmeeedalf commented May 4, 2023

Description

Copy&Pasting an image from Firefox looks to paste something in the textbox, but upon sending Quaternion crashes with an assert failure: ASSERT: "!plainText.isEmpty() && !htmlText.isEmpty()" in file /.../client/chatroomwidget.cpp, line 428

Steps to reproduce

  • Copy an image, test from a web page
  • Paste in Quaternion chat field
  • Hit ENTER to send

Ideal behavior would be to convert the paste into an image upload, like Element does. However, not crashing, or even just outright rejecting an image paste, would also work.

Adding some printf debugging to ChatEdit::insertFromMimeData(), I see the following:

hasHtml: true hasImage: true

html: "<meta http-equiv="content-type" content="text/html; charset=utf-8"><img class="avatar avatar-user" src="https://avatars.githubusercontent.com/u/1408010?s=52&amp;v=4\" alt="@chmeeedalf" width="26" height="26">" -- end

"html: " and " -- end" being added by me as delimiters.

Quaternion dumps logs to the standard output. If you can find the logs and
identify any log snippets relevant to your issue, please include
those here (please be careful to remove any personal or private data):

ASSERT: "!plainText.isEmpty() && !htmlText.isEmpty()" in file /.../client/chatroomwidget.cpp, line 428

Version information

  • Quaternion version: 0.0.96-beta
  • Qt version: 5.15.8
  • Install method: Build from source (zip file download from GitHub)
  • Platform: Debian Bookworm, ppc64el
@chmeeedalf chmeeedalf changed the title Pasting an image to the chat window crashes on send Pasting an image from a browser to the chat window crashes on send May 4, 2023
chmeeedalf added a commit to chmeeedalf/Quaternion that referenced this issue May 4, 2023
Copying an image from Firefox attaches some HTML to the image.
Extracting the plain text from the HTML before the image results in
empty data in the field, with no image, triggering an assertion failure
on message send.

This is a partial fix for issue quotient-im#867.  Partial, because the resulting
image does not appear in the chat window until relaunching, due to an
error opening the temp file created by this.
@KitsuneRal KitsuneRal added the bug/fix Quaternion doesn't work as expected label May 6, 2023
@chmeeedalf
Copy link
Contributor Author

This as-is was fixed by PR #868, will open a different issue for image uploads.

@KitsuneRal KitsuneRal added this to Version 0.0.96 - To Do in Quaternion 1 Jul 12, 2023
@KitsuneRal
Copy link
Member

Did you open that other issue? I don't seem to find it.

@chmeeedalf
Copy link
Contributor Author

Yeah, it's issue #869.

@KitsuneRal
Copy link
Member

Oh, thanks, this slipped through my fingers.

@KitsuneRal KitsuneRal linked a pull request Jul 31, 2023 that will close this issue
@KitsuneRal KitsuneRal moved this from Version 0.0.96 - To Do to Version 0.0.96 - Done in Quaternion 1 Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/fix Quaternion doesn't work as expected
Projects
Quaternion 1
  
Version 0.0.96 - Done
Development

Successfully merging a pull request may close this issue.

2 participants