EionRobb / purple-mattermost

A libpurple/Pidgin plugin for Mattermost
GNU General Public License v3.0
93 stars 23 forks source link

html formatting breaks text #67

Open Jellyfrog opened 6 years ago

Jellyfrog commented 6 years ago

Pasting a html formatted text breaks something in pidgin/this plugin...

My clipboard:

<span style='font-weight: normal;'><font size="2"><font color="#cc0000">(10:00:05) </font></font></span><span style='font-weight: bold;color: #cc0000;'>Foo: </span>Bar<br><span style='font-weight: normal;'><font size="2"><font color="#cc0000">(10:00:13) </font></font></span><span style='font-weight: bold;color: #cc0000;'>Foo: </span>bar

Debug log:

(10:36:13) GLib: Source ID 489052 was not found when attempting to remove it
(10:36:15) GLib: g_markup_parse_context_parse: assertion 'context->state != STATE_ERROR' failed
(10:36:15) GLib: g_markup_parse_context_end_parse: assertion 'context->state != STATE_ERROR' failed
(10:36:15) mattermost: Fetching url http://mattermost/api/v3/teams/guytssrcpfr8uk4yaxtrsuk7qa/channels/gdyh8mrycin5m86rf1xqmu45sb/posts/create
(10:36:15) mattermost: With postdata {"pending_post_id":"0000C9EAE251FFFF","channel_id":"gdyh8mrycin5m86rf1xqmu45sb","message":"(10:00:05) **Foo: **Bar\n(10:00:13) **Foo: **","user_id":"t674q3id5j8iudtbaa583csn5z","create_at":0}

Note the last "bar" is missing.

To reproduce in linux:

  1. echo "<span style='font-weight: normal;'><font size="2"><font color="#cc0000">(10:00:05) </font></font></span><span style='font-weight: bold;color: #cc0000;'>Foo: </span>Bar<br><span style='font-weight: normal;'><font size="2"><font color="#cc0000">(10:00:13) </font></font></span><span style='font-weight: bold;color: #cc0000;'>Foo: </span>bar" | xclip -selection clipboard -i -t text/html
  2. Paste in chat
  3. Send
wom-bat commented 5 years ago

HTML seems to have other issues too. Things posted in angle brackets on mattermost disappear: the slack to mattermost bridge for instance puts atttributions in angle brackets --- these disappear unless they contain a dot.