element-hq / hydrogen-web

Lightweight matrix client with legacy and mobile browser support
Apache License 2.0
644 stars 124 forks source link

HTML message results to something went wrong r.body is not an object #768

Open Mikaela opened 2 years ago

Mikaela commented 2 years ago

Describe the bug

Event in question https://matrix.to/#/!sOLQNHloevPHIEWcYN%3Amatrix.org/%24aHEbZNVdrZKk9E-vfK4LbYaY1ZZtFnYM108Kc8Nc0Jk

{
  "content": {
    "body": "<h1>h1</h1> <h2>h2</h2> <h3>h3</h3> <h4>h4</h4> <h5>h5</h5> <h6>h6</h6> <del>del</del> <strike>strike</strike> <sub>sub</sub> <span data-mx-color=\"#00ff00\">span data-mx-color green</span> <span data-mx-bg-color=\"#ff0000\">span data-mx-bg-color red</span> <sup>sup</sup> <br> ... br <font data-mx-color=\"#00ff00\">font data-mx-color green</font> <font data-mx-bg-color=\"#ff0000\">font data-mx-bg-color red</font> <font color=\"#00ff00\">font color green</font> <hr> ... hr <b>b</b> <i>i</i> <strong>strong</strong> <em>em</em> <p>p</p> <u>u</u> <ol start=42><li>item 42</li><li>item 43</li></ol> <ul><li>some bullet</li><li>another bullet</li></ul> <table><caption>table caption</caption><thead><tr><th>table head column 1</th><th>col 2</th><th>col 3</th></tr></thead><tbody><tr><th>body row 2 head</th><td>r2c2</td><td>r2c3</td></tr><tr><th>r3h</th><td>r3c2</td><td>r3c3</td></tr></tbody></table> <details><summary>summary (click to see details)</summary> details</details> <span data-mx-spoiler=\"click to reveal\">span data-mx-spoiler</span> <span data-mx-maths=\"span \\over{ data-mx-maths}\"><code>span \\over{ data-mx-maths}</code></span> <div data-mx-maths=\"div \\over{ data-mx-maths}\"><code>div \\over{ data-mx-maths}</code></div> <blockquote>blockquote</blockquote> <code>var code = \"\"; // highlight</code> <pre><code class=\"language-haxe\">var preCode = \"language-haxe\"; // highlight</code></pre> <code class=\"language-haxe\">var code = \"language-haxe\"; // highlight</code> <pre>var pre = \"\"; // highlight</pre> <pre><code>var preCode = \"\"; // highlight</code></pre> <a href=\"https://framasphere.org/posts/5557d800db2001370ad8543d7eeced27\"><img src=\"mxc://grin.hu/iXjxZOXmgszkaLgchvrNSVCO/cat-on-tv-technology-doesnt-change-everything-for-the-better.jpeg\" width=130 alt=\"cat sleeping on top of flat TV\" title=\"&lt;img&gt; Cat on top of TV: Technology doesn't change everything for the better\" /></a> ... mxc:// img <a href=\"https://diasp.eu/posts/aa9dc730ab7b013a1d0b101b0efced44\">a href https://</a> <a href=\"mailto:a@example.com,b@example.com?cc=c@example.com&amp;bcc=d@example.com&amp;subject=hello&amp;body=from%20matrix\">a href mailto:</a> <a href=\"magnet:?xt=urn:btih:ef6b1a1a21767fd63332674b77f900e33017a778&amp;dn=Ubuntu%20%C3%89retts%C3%A9gi%20Remix%2019.04\">a href magnet:</a> <a href=\"ftp://example.com/\">a href ftp://</a>",
    "format": "org.matrix.custom.html",
    "formatted_body": "<h1>h1</h1> <h2>h2</h2> <h3>h3</h3> <h4>h4</h4> <h5>h5</h5> <h6>h6</h6> <del>del</del> <strike>strike</strike> <sub>sub</sub> <span data-mx-color=\"#00ff00\">span data-mx-color green</span> <span data-mx-bg-color=\"#ff0000\">span data-mx-bg-color red</span> <sup>sup</sup> <br> ... br <font data-mx-color=\"#00ff00\">font data-mx-color green</font> <font data-mx-bg-color=\"#ff0000\">font data-mx-bg-color red</font> <font color=\"#00ff00\">font color green</font> <hr> ... hr <b>b</b> <i>i</i> <strong>strong</strong> <em>em</em> <p>p</p> <u>u</u> <ol start=42><li>item 42</li><li>item 43</li></ol> <ul><li>some bullet</li><li>another bullet</li></ul> <table><caption>table caption</caption><thead><tr><th>table head column 1</th><th>col 2</th><th>col 3</th></tr></thead><tbody><tr><th>body row 2 head</th><td>r2c2</td><td>r2c3</td></tr><tr><th>r3h</th><td>r3c2</td><td>r3c3</td></tr></tbody></table> <details><summary>summary (click to see details)</summary> details</details> <span data-mx-spoiler=\"click to reveal\">span data-mx-spoiler</span> <span data-mx-maths=\"span \\over{ data-mx-maths}\"><code>span \\over{ data-mx-maths}</code></span> <div data-mx-maths=\"div \\over{ data-mx-maths}\"><code>div \\over{ data-mx-maths}</code></div> <blockquote>blockquote</blockquote> <code>var code = \"\"; // highlight</code> <pre><code class=\"language-haxe\">var preCode = \"language-haxe\"; // highlight</code></pre> <code class=\"language-haxe\">var code = \"language-haxe\"; // highlight</code> <pre>var pre = \"\"; // highlight</pre> <pre><code>var preCode = \"\"; // highlight</code></pre> <a href=\"https://framasphere.org/posts/5557d800db2001370ad8543d7eeced27\"><img src=\"mxc://grin.hu/iXjxZOXmgszkaLgchvrNSVCO/cat-on-tv-technology-doesnt-change-everything-for-the-better.jpeg\" width=130 alt=\"cat sleeping on top of flat TV\" title=\"&lt;img&gt; Cat on top of TV: Technology doesn't change everything for the better\" /></a> ... mxc:// img <a href=\"https://diasp.eu/posts/aa9dc730ab7b013a1d0b101b0efced44\">a href https://</a> <a href=\"mailto:a@example.com,b@example.com?cc=c@example.com&amp;bcc=d@example.com&amp;subject=hello&amp;body=from%20matrix\">a href mailto:</a> <a href=\"magnet:?xt=urn:btih:ef6b1a1a21767fd63332674b77f900e33017a778&amp;dn=Ubuntu%20%C3%89retts%C3%A9gi%20Remix%2019.04\">a href magnet:</a> <a href=\"ftp://example.com/\">a href ftp://</a>",
    "msgtype": "m.text",
    "org.matrix.msc1767.message": [
      {
        "body": "<h1>h1</h1> <h2>h2</h2> <h3>h3</h3> <h4>h4</h4> <h5>h5</h5> <h6>h6</h6> <del>del</del> <strike>strike</strike> <sub>sub</sub> <span data-mx-color=\"#00ff00\">span data-mx-color green</span> <span data-mx-bg-color=\"#ff0000\">span data-mx-bg-color red</span> <sup>sup</sup> <br> ... br <font data-mx-color=\"#00ff00\">font data-mx-color green</font> <font data-mx-bg-color=\"#ff0000\">font data-mx-bg-color red</font> <font color=\"#00ff00\">font color green</font> <hr> ... hr <b>b</b> <i>i</i> <strong>strong</strong> <em>em</em> <p>p</p> <u>u</u> <ol start=42><li>item 42</li><li>item 43</li></ol> <ul><li>some bullet</li><li>another bullet</li></ul> <table><caption>table caption</caption><thead><tr><th>table head column 1</th><th>col 2</th><th>col 3</th></tr></thead><tbody><tr><th>body row 2 head</th><td>r2c2</td><td>r2c3</td></tr><tr><th>r3h</th><td>r3c2</td><td>r3c3</td></tr></tbody></table> <details><summary>summary (click to see details)</summary> details</details> <span data-mx-spoiler=\"click to reveal\">span data-mx-spoiler</span> <span data-mx-maths=\"span \\over{ data-mx-maths}\"><code>span \\over{ data-mx-maths}</code></span> <div data-mx-maths=\"div \\over{ data-mx-maths}\"><code>div \\over{ data-mx-maths}</code></div> <blockquote>blockquote</blockquote> <code>var code = \"\"; // highlight</code> <pre><code class=\"language-haxe\">var preCode = \"language-haxe\"; // highlight</code></pre> <code class=\"language-haxe\">var code = \"language-haxe\"; // highlight</code> <pre>var pre = \"\"; // highlight</pre> <pre><code>var preCode = \"\"; // highlight</code></pre> <a href=\"https://framasphere.org/posts/5557d800db2001370ad8543d7eeced27\"><img src=\"mxc://grin.hu/iXjxZOXmgszkaLgchvrNSVCO/cat-on-tv-technology-doesnt-change-everything-for-the-better.jpeg\" width=130 alt=\"cat sleeping on top of flat TV\" title=\"&lt;img&gt; Cat on top of TV: Technology doesn't change everything for the better\" /></a> ... mxc:// img <a href=\"https://diasp.eu/posts/aa9dc730ab7b013a1d0b101b0efced44\">a href https://</a> <a href=\"mailto:a@example.com,b@example.com?cc=c@example.com&amp;bcc=d@example.com&amp;subject=hello&amp;body=from%20matrix\">a href mailto:</a> <a href=\"magnet:?xt=urn:btih:ef6b1a1a21767fd63332674b77f900e33017a778&amp;dn=Ubuntu%20%C3%89retts%C3%A9gi%20Remix%2019.04\">a href magnet:</a> <a href=\"ftp://example.com/\">a href ftp://</a>",
        "mimetype": "text/plain"
      },
      {
        "body": "<h1>h1</h1> <h2>h2</h2> <h3>h3</h3> <h4>h4</h4> <h5>h5</h5> <h6>h6</h6> <del>del</del> <strike>strike</strike> <sub>sub</sub> <span data-mx-color=\"#00ff00\">span data-mx-color green</span> <span data-mx-bg-color=\"#ff0000\">span data-mx-bg-color red</span> <sup>sup</sup> <br> ... br <font data-mx-color=\"#00ff00\">font data-mx-color green</font> <font data-mx-bg-color=\"#ff0000\">font data-mx-bg-color red</font> <font color=\"#00ff00\">font color green</font> <hr> ... hr <b>b</b> <i>i</i> <strong>strong</strong> <em>em</em> <p>p</p> <u>u</u> <ol start=42><li>item 42</li><li>item 43</li></ol> <ul><li>some bullet</li><li>another bullet</li></ul> <table><caption>table caption</caption><thead><tr><th>table head column 1</th><th>col 2</th><th>col 3</th></tr></thead><tbody><tr><th>body row 2 head</th><td>r2c2</td><td>r2c3</td></tr><tr><th>r3h</th><td>r3c2</td><td>r3c3</td></tr></tbody></table> <details><summary>summary (click to see details)</summary> details</details> <span data-mx-spoiler=\"click to reveal\">span data-mx-spoiler</span> <span data-mx-maths=\"span \\over{ data-mx-maths}\"><code>span \\over{ data-mx-maths}</code></span> <div data-mx-maths=\"div \\over{ data-mx-maths}\"><code>div \\over{ data-mx-maths}</code></div> <blockquote>blockquote</blockquote> <code>var code = \"\"; // highlight</code> <pre><code class=\"language-haxe\">var preCode = \"language-haxe\"; // highlight</code></pre> <code class=\"language-haxe\">var code = \"language-haxe\"; // highlight</code> <pre>var pre = \"\"; // highlight</pre> <pre><code>var preCode = \"\"; // highlight</code></pre> <a href=\"https://framasphere.org/posts/5557d800db2001370ad8543d7eeced27\"><img src=\"mxc://grin.hu/iXjxZOXmgszkaLgchvrNSVCO/cat-on-tv-technology-doesnt-change-everything-for-the-better.jpeg\" width=130 alt=\"cat sleeping on top of flat TV\" title=\"&lt;img&gt; Cat on top of TV: Technology doesn't change everything for the better\" /></a> ... mxc:// img <a href=\"https://diasp.eu/posts/aa9dc730ab7b013a1d0b101b0efced44\">a href https://</a> <a href=\"mailto:a@example.com,b@example.com?cc=c@example.com&amp;bcc=d@example.com&amp;subject=hello&amp;body=from%20matrix\">a href mailto:</a> <a href=\"magnet:?xt=urn:btih:ef6b1a1a21767fd63332674b77f900e33017a778&amp;dn=Ubuntu%20%C3%89retts%C3%A9gi%20Remix%2019.04\">a href magnet:</a> <a href=\"ftp://example.com/\">a href ftp://</a>",
        "mimetype": "text/html"
      }
    ]
  },
  "origin_server_ts": 1656356930006,
  "room_id": "!sOLQNHloevPHIEWcYN:matrix.org",
  "sender": "@bkil:matrix.org",
  "type": "m.room.message",
  "unsigned": {
    "age": 41281325
  },
  "event_id": "$aHEbZNVdrZKk9E-vfK4LbYaY1ZZtFnYM108Kc8Nc0Jk",
  "user_id": "@bkil:matrix.org",
  "age": 41281325
}

Result

To Reproduce Steps to reproduce the behavior: b Receive html formatted message Expected behavior A clear and concise description of what you expected to happen.

Screenshots

image

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

Mikaela commented 2 years ago

My browser freezes editing this.

Hydrogen 0.2.32 (4197437774) installed from Safari on latest iOS on iPhone SE2020