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

Autolinking should not stop when encountering first & #235

Open
bkil opened this issue May 29, 2023 · 3 comments
Open

Autolinking should not stop when encountering first & #235

bkil opened this issue May 29, 2023 · 3 comments
Labels
A-archive-room-view The view to look at a room day by day in the archive A-SSR Server-side rendering (backend) help wanted PR's welcome to fix this issue. It probably has a potential solution documented in the issue. T-Defect Something isn't working. Bugs, crashes, or other reported issues.

Comments

@bkil
Copy link

bkil commented May 29, 2023

Autolinking should not stop when encountering first &

Example

archive matrix org_issues_235_autolinking_ampersand

{
  "content": {
    "body": "Excellent. Seems like some (most?) clients would probably fail to scroll back to this time in history:\n* https://matrix.to/#/!sOLQNHloevPHIEWcYN:matrix.org/$vofnzkokpJxtvNEGbZN9fWsCxFJc9UX2CIsQj4ZTW38?via=matrix.org&via=tchncs.de&via=t2bot.io",
    "format": "org.matrix.custom.html",
    "formatted_body": "<p>Excellent. Seems like some (most?) clients would probably fail to scroll back to this time in history:</p>\n<ul>\n<li>https://matrix.to/#/!sOLQNHloevPHIEWcYN:matrix.org/$vofnzkokpJxtvNEGbZN9fWsCxFJc9UX2CIsQj4ZTW38?via=matrix.org&amp;via=tchncs.de&amp;via=t2bot.io</li>\n</ul>\n",
    "msgtype": "m.text"
  },
  "origin_server_ts": 1685370132404,
  "sender": "@bkil:grin.hu",
  "type": "m.room.message",
  "unsigned": {
    "m.relations": {
      "m.thread": {
        "latest_event": {
          "content": {
            "body": "mine fails. And I had same issue several times today.",
            "m.relates_to": {
              "event_id": "$5cQZRtG9bsleXZI2x-s6wEDfeZ5B1nC_jEvOwpA-VdI",
              "is_falling_back": true,
              "m.in_reply_to": {
                "event_id": "$5cQZRtG9bsleXZI2x-s6wEDfeZ5B1nC_jEvOwpA-VdI"
              },
              "rel_type": "m.thread"
            },
            "msgtype": "m.text"
          },
          "origin_server_ts": 1685370490952,
          "room_id": "!sOLQNHloevPHIEWcYN:matrix.org",
          "sender": "@iam:pavli.cc",
          "type": "m.room.message",
          "unsigned": {},
          "event_id": "$AlmvB1jPcCIn3Tdv-izDFzQ1-P5k3sPcHZ0Kogkc_so",
          "user_id": "@iam:pavli.cc"
        },
        "count": 1,
        "current_user_participated": false
      }
    }
  },
  "event_id": "$5cQZRtG9bsleXZI2x-s6wEDfeZ5B1nC_jEvOwpA-VdI",
  "room_id": "!sOLQNHloevPHIEWcYN:matrix.org"
}
@MadLittleMods
Copy link
Contributor

MadLittleMods commented May 30, 2023

@bkil Can you give an example? (link and event JSON)

I'm unable to reproduce:

@MadLittleMods MadLittleMods added X-Cannot-Reproduce The project maintainers are unable to reproduce this problem in order to find out what's going wrong T-Defect Something isn't working. Bugs, crashes, or other reported issues. A-archive-room-view The view to look at a room day by day in the archive X-Needs-Info This issue is blocked awaiting information from the reporter labels May 30, 2023
@bkil
Copy link
Author

bkil commented May 30, 2023

@MadLittleMods

archive matrix org_issues_235_autolinking_ampersand

{
  "content": {
    "body": "Excellent. Seems like some (most?) clients would probably fail to scroll back to this time in history:\n* https://matrix.to/#/!sOLQNHloevPHIEWcYN:matrix.org/$vofnzkokpJxtvNEGbZN9fWsCxFJc9UX2CIsQj4ZTW38?via=matrix.org&via=tchncs.de&via=t2bot.io",
    "format": "org.matrix.custom.html",
    "formatted_body": "<p>Excellent. Seems like some (most?) clients would probably fail to scroll back to this time in history:</p>\n<ul>\n<li>https://matrix.to/#/!sOLQNHloevPHIEWcYN:matrix.org/$vofnzkokpJxtvNEGbZN9fWsCxFJc9UX2CIsQj4ZTW38?via=matrix.org&amp;via=tchncs.de&amp;via=t2bot.io</li>\n</ul>\n",
    "msgtype": "m.text"
  },
  "origin_server_ts": 1685370132404,
  "sender": "@bkil:grin.hu",
  "type": "m.room.message",
  "unsigned": {
    "m.relations": {
      "m.thread": {
        "latest_event": {
          "content": {
            "body": "mine fails. And I had same issue several times today.",
            "m.relates_to": {
              "event_id": "$5cQZRtG9bsleXZI2x-s6wEDfeZ5B1nC_jEvOwpA-VdI",
              "is_falling_back": true,
              "m.in_reply_to": {
                "event_id": "$5cQZRtG9bsleXZI2x-s6wEDfeZ5B1nC_jEvOwpA-VdI"
              },
              "rel_type": "m.thread"
            },
            "msgtype": "m.text"
          },
          "origin_server_ts": 1685370490952,
          "room_id": "!sOLQNHloevPHIEWcYN:matrix.org",
          "sender": "@iam:pavli.cc",
          "type": "m.room.message",
          "unsigned": {},
          "event_id": "$AlmvB1jPcCIn3Tdv-izDFzQ1-P5k3sPcHZ0Kogkc_so",
          "user_id": "@iam:pavli.cc"
        },
        "count": 1,
        "current_user_participated": false
      }
    }
  },
  "event_id": "$5cQZRtG9bsleXZI2x-s6wEDfeZ5B1nC_jEvOwpA-VdI",
  "room_id": "!sOLQNHloevPHIEWcYN:matrix.org"
}

@matrix-org matrix-org deleted a comment from bkil May 30, 2023
@MadLittleMods MadLittleMods added help wanted PR's welcome to fix this issue. It probably has a potential solution documented in the issue. and removed X-Cannot-Reproduce The project maintainers are unable to reproduce this problem in order to find out what's going wrong X-Needs-Info This issue is blocked awaiting information from the reporter labels May 30, 2023
@MadLittleMods
Copy link
Contributor

Thanks for the extra details @bkil!

This looks like a problem with the server-side rendered (SSR) HTML of an event with formatted_body and fixes itself after the the client-side JavaScript kicks in and fixes the link.

Server-side rendered HTML:

<div class="Timeline_messageBody">
   <!--node binding placeholder-->
   <p>Excellent. Seems like some (most?) clients would probably fail to scroll back to this time in history:</p>
   <ul>
      <li><a rel="noopener" target="_blank" class="link" href="https://matrix.to/#/!sOLQNHloevPHIEWcYN:matrix.org/$vofnzkokpJxtvNEGbZN9fWsCxFJc9UX2CIsQj4ZTW38?via=matrix.org">https://matrix.to/#/!sOLQNHloevPHIEWcYN:matrix.org/$vofnzkokpJxtvNEGbZN9fWsCxFJc9UX2CIsQj4ZTW38?via=matrix.org</a>&amp;via=tchncs.de&amp;via=t2bot.io</li>
   </ul>
   <time>2:22 PM</time>
</div>

This would be the server-side rendered output of Hydrogen but looks like this isn't a problem with Hydrogen itself because it seems to work out fine in the browser context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-archive-room-view The view to look at a room day by day in the archive A-SSR Server-side rendering (backend) help wanted PR's welcome to fix this issue. It probably has a potential solution documented in the issue. T-Defect Something isn't working. Bugs, crashes, or other reported issues.
Projects
None yet
Development

No branches or pull requests

2 participants