mautrix / slack

A Matrix-Slack puppeting bridge
GNU Affero General Public License v3.0
61 stars 17 forks source link

Long URLs aren't bridged correctly #16

Closed ptman closed 11 months ago

ptman commented 1 year ago

E.g.

https://www.kauppalehti.fi/uutiset/supercell-peraa-asennemuutosta-yrityksiin-osaajat-lahtevat-jos-puoliso-ei-saa-toita/3b0779a2-87fb-4968-b3a4-78b49938543e

was bridged as:

https://www.kauppalehti.fi/uutiset/supercell-peraa-asennemuutosta-yrityksiin-osaajat-l[...]s-puoliso-ei-saa-toita/3b0779a2-87fb-4968-b3a4-78b49938543e
slagiewka commented 11 months ago

I used the link of yours and I can't reproduce

image

I'm using the latest docker build from 17.07: cb748db

I think the edit is only because there's some automatic reformatting, so it might be irrelevant:

{
  "content": {
    "msgtype": "m.text",
    "body": "* https://www.kauppalehti.fi/uutiset/supercell-peraa-asennemuutosta-yrityksiin-osaajat-lahtevat-jos-puoliso-ei-saa-toita/3b0779a2-87fb-4968-b3a4-78b49938543e",
    "format": "org.matrix.custom.html",
    "formatted_body": "* <a href=\"https://www.kauppalehti.fi/uutiset/supercell-peraa-asennemuutosta-yrityksiin-osaajat-lahtevat-jos-puoliso-ei-saa-toita/3b0779a2-87fb-4968-b3a4-78b49938543e\">https://www.kauppalehti.fi/uutiset/supercell-peraa-asennemuutosta-yrityksiin-osaajat-lahtevat-jos-puoliso-ei-saa-toita/3b0779a2-87fb-4968-b3a4-78b49938543e</a>",
    "m.new_content": {
      "msgtype": "m.text",
      "body": "https://www.kauppalehti.fi/uutiset/supercell-peraa-asennemuutosta-yrityksiin-osaajat-lahtevat-jos-puoliso-ei-saa-toita/3b0779a2-87fb-4968-b3a4-78b49938543e",
      "format": "org.matrix.custom.html",
      "formatted_body": "<a href=\"https://www.kauppalehti.fi/uutiset/supercell-peraa-asennemuutosta-yrityksiin-osaajat-lahtevat-jos-puoliso-ei-saa-toita/3b0779a2-87fb-4968-b3a4-78b49938543e\">https://www.kauppalehti.fi/uutiset/supercell-peraa-asennemuutosta-yrityksiin-osaajat-lahtevat-jos-puoliso-ei-saa-toita/3b0779a2-87fb-4968-b3a4-78b49938543e</a>"
    },
    "m.relates_to": {
      "rel_type": "m.replace",
      "event_id": "$hITLNIbrFFbON-EjlfTh7ideIIm3K2fBKnCtLR0rGZg"
    }
  },
}
ptman commented 11 months ago

Great if it works. Did you try both directions?

slagiewka commented 11 months ago

Did you try both directions?

I did, just now. Looks OK to me. This time no edits visible. That might be due to Slack no longer "unfurling" the preview on their side (as it was already added to previous messages with myself).

I think I've seen the approach to shorten display of links on Slack when they're to long, but actual links are still correct. Maybe this issue was:

OR

twouters commented 11 months ago

Not sure why but I'm still seeing this issue if I paste the url from the issue report in a DM to myself (on Slack).

The bridge even seems to be looping on this message as the edits keep piling up on Matrix:

Screenshot from 2023-08-02 13-36-59

Screenshot from 2023-08-02 13-37-53

twouters commented 11 months ago

@ptman i think this needs to be reopened

slagiewka commented 11 months ago

Another round of testing. This time on a different computer (with macOS).

image

When I'm pasting into Slack (web in Firefox or native app), the link is already [...]-fied even before I send it. Then I see that effect in Matrix (Element). But the link is still properly working (as demonstrated above).