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

Horn doesn't accept web links #81

Open
tiagoshibata opened this issue Apr 12, 2019 · 7 comments · May be fixed by integram-org/webhook#2
Open

Horn doesn't accept web links #81

tiagoshibata opened this issue Apr 12, 2019 · 7 comments · May be fixed by integram-org/webhook#2

Comments

@tiagoshibata
Copy link

Using Slack-formatted web links doesn't work in Horn. Examples:

curl -X POST -d '{
    "text": "Link: <google.com>!"
}' https://integram.org/webhook/...
curl -X POST -d '{
    "text": "Link: <google.com|this is a link>!"
}' https://integram.org/webhook/...

In both cases, all text between < and > is removed.

image

@tiagoshibata
Copy link
Author

Just for clarification: Slack uses its own formatting language instead of Markdown. Links are represented as <Links|Display text>, such as <mailto:[email protected]|Bob> , and the horn bot doesn't convert the <> link to proper markdown. The reference documentation explains it:

The mrkdwn attribute is missing vowels because our markup language is not quite markdown but something quite like it.

@tiagoshibata
Copy link
Author

I'm working on a fix and will open a PR at https://github.com/integram-org/webhook . It might take me a while since I'm not familiar with Go.

@tiagoshibata
Copy link
Author

FYI, I implemented this, which fixes the issue: https://play.golang.org/p/nj0YB1xkLsK

I'll add a few more checks (e.g. Slack doesn't convert links if there's a new line between the opening < and >), test on the bot and create a PR.

@requilence
Copy link
Owner

@tiagoshibata sorry for a long reply.
Thanks for pointing out to this issue. Will you be able to create the PR?

@tiagoshibata
Copy link
Author

tiagoshibata commented Jun 9, 2019

Yes, I can create the PR :) I have the code ready, I'll polish it later today and open the PR.

@tiagoshibata
Copy link
Author

I'll give it a bit more thought before opening the PR. I found out e.g. CircleCI sends the following request to Slack:

{
    "attachments": [
        {
            "fallback": "Failed: tiagoshibata's workflow (<https://circleci.com/REDACTED|Build Error>) in <https://circleci.com/bb/REDACTED|tiagoshibata/REDACTED> (<https://circleci.com/bb/tiagoshibata/REDACTED>)\n- ...",
            "text": "Failed: tiagoshibata's workflow (<https://circleci.com/REDACTED|Build Error>) in <https://circleci.com/bb/REDACTED|tiagoshibata/REDACTED> (<https://circleci.com/bb/tiagoshibata/REDACTED>)\n- ...",
            "color": "#d10c20"
        }
    ],
    "text": "",
    "channel": null
}

Which doesn't have the mrkdwn_in attribute set for the attachment, but Slack still parses its links. After some testing it seems like Slack always parses the <link|text> tags, even with markdown disabled. My current implementation only replaces these tags with the markdown equivalent, I'll look into making it work with the Telegram HTML parser too.

@tiagoshibata tiagoshibata linked a pull request Jun 22, 2019 that will close this issue
@tiagoshibata
Copy link
Author

Opened at integram-org/webhook#2 , please take a look whenever you can :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants