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

fix TWIM-bot(?) eating links #2398

Open
HarHarLinks opened this issue Jun 14, 2024 · 7 comments
Open

fix TWIM-bot(?) eating links #2398

HarHarLinks opened this issue Jun 14, 2024 · 7 comments
Labels
bug Something is broken. meta Things that are foundation related or external services mentioning matrix that need changes

Comments

@HarHarLinks
Copy link
Contributor

HarHarLinks commented Jun 14, 2024

might be limited to matrix.to links.

image
image
image

@HarHarLinks
Copy link
Contributor Author

@MTRNord
Copy link
Collaborator

MTRNord commented Jun 14, 2024

Considering the nheko post was done on probably nheko (@deepbluev7 please confirm) https://github.com/haecker-felix/hebbot/blob/b230bd3749a90a9f6bb642536074154f3658a92a/src/render.rs#L347-L353 has also a bug since it missed 2 things.

@MTRNord
Copy link
Collaborator

MTRNord commented Jun 14, 2024

On further investigation its because the first regex checks for start of line. Thats not given due to the braces. the second one checks for a space before. Thats also not given. @haecker-felix Is the space on the second regex a typo or a bug? 🤔 I can make a PR if needed I think

@MTRNord MTRNord added bug Something is broken. meta Things that are foundation related or external services mentioning matrix that need changes labels Jun 14, 2024
@deepbluev7
Copy link
Contributor

deepbluev7 commented Jun 14, 2024

Do I read it correctly, that that regex is checking for room matrix.to links starting with a #? That only works for aliases sent by clients not following the matrix spec, since the spec suggests identifiers should be escaped, which means links start with https://matrix.to/#/%23, not https://matrix.to/#/# (and the url RFC also says there should be no unescaped # in urls).

EDIT: Seems like it works on the body of the message, which usually doesn't have a matrix.to link at all, so it probably isn't trying to match against a matrix.to link but instead against any alias.

@HarHarLinks
Copy link
Contributor Author

HarHarLinks commented Jun 14, 2024

and the given regex can also not work with aliases in brackets e.g. (#matrix-spec:matrix.org) as seen in OP

@haecker-felix
Copy link

On further investigation its because the first regex checks for start of line. Thats not given due to the braces. the second one checks for a space before. Thats also not given. @haecker-felix Is the space on the second regex a typo or a bug? 🤔 I can make a PR if needed I think

I can't remember anymore how / why I did the regex in this way, too long ago. If it causes problems, please feel free to open a PR.

@HarHarLinks
Copy link
Contributor Author

hm but what causes the user (@) pills to get lost? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken. meta Things that are foundation related or external services mentioning matrix that need changes
Projects
None yet
Development

No branches or pull requests

4 participants