21

I tried to edit a question which used a roundabout way to refer to documentation it was working with. I formatted them as proper links however, I quickly found out why the user chose a roundabout way to present them. With proper links there is a message:

Body cannot contain "https://adf.ly/static".

Please avoid using URL shorteners; they can break without leaving any useful artifact and are often used to obscure spam or malicious links.
Editors: please replace the short URL noted above with the URL it redirects to!
For details, see meta.

Screenshot showing the body text of the post which triggers shown above

This is the text in the body which throws a problem:

 - [Link of official docs](https://adf.ly/static/other/adfly_api_v1_documentation.pdf?v=20191108)

 - [Link of examples](https://adf.ly/static/other/AdflyApiExamples.zip?v=20180819)

Both of these links are not shortened. There is nothing to expand - this is the link to the documentation for the API. And the question is directly related. Not much different to saying "I use X from Y" and linking to the API documentation for Y.

I ended up using this:

 - Link of official docs: `https://adf.ly/` + `/static/other/adfly_api_v1_documentation.pdf?v=20191108`

 - Link of examples: `https://adf.ly/` + `static/other/AdflyApiExamples.zip?v=20180819`

How can such links be usefully displayed within a post? Having to partially obscure them makes it seem there is something shady happening when it is actually relevant information.

3
  • Nice hack though, I did not know that was possible. The block even happens when the links are posted in a code block?
    – Gimby
    Commented Feb 28, 2022 at 11:08
  • @Gimby correct. I tried inline link (single backtick) and block code (triple backtick). It's blocked in both cases. It doesn't seem to be blocked on Meta, hence why I was able to post the code blocks here. Seems there is just a regex that looks for adf.ly/static URL-looking string in the body of the post and triggers the block. Hence...the hack.
    – VLAZ
    Commented Feb 28, 2022 at 11:10
  • If that is the case then that would be a bug because redirect url's won't have the /static part of the url in them from what I can tell.
    – Gimby
    Commented Feb 28, 2022 at 12:47

1 Answer 1

9

You can use percent encoding within the URL.

I've edited the answer on which you had this issue to use percent encoding for the first portion of the URL. So, the links are now:

 - [Official documentation](https://%61%64%66.%6c%79/static/other/adfly_api_v1_documentation.pdf?v=20191108)<!--link shortener ban on Stack Exchange erroneously prevents posting the link when not encoded. -->
 - [Official examples](https://%61%64%66.%6c%79/static/other/AdflyApiExamples.zip?v=20180819)<!--link shortener ban on Stack Exchange erroneously prevents posting the link when not encoded. -->

Which produces:

9
  • 2
    great, so that gives people hungry for posting adfly links a way to bypass the Stack Overflow filter. Commented Feb 28, 2022 at 16:24
  • LOL! And it works in the comments, too.
    – 41686d6564
    Commented Feb 28, 2022 at 16:40
  • I don't really think that meets VLAZ's request though, it still looks like something shady is going on like this. More so, I would say :)
    – Gimby
    Commented Mar 1, 2022 at 8:57
  • 1
    @Gimby While I didn't make an exhaustive attempt at variations, this works. Browsers (at least Chrome and Firefox) display the decoded URL to users when the link is hovered, so it accurately reflects where it will link to and doesn't look strange unless the user is editing. For editing, there's the HTML comment which explains why the percent encoding is used. I guess the comments could be more verbose. VLAZ's request is a support request, i.e. "how do I do this". If it's desired that the filtering actually change, then that would be a feature-request or bug.
    – Makyen Mod
    Commented Mar 1, 2022 at 9:07
  • Aaaah, yeah that's fair enough. Nice hack! I'm sure there is some site out there which makes it easy to generate the percent encoding...
    – Gimby
    Commented Mar 1, 2022 at 10:08
  • Yes, indeed, that does meet my requirements. I asked how to handle it. With the intention to potentially follow up post a FR/bug depending on the result. I'd still post an FR for allowing these URLS.
    – VLAZ
    Commented Mar 1, 2022 at 10:14
  • Wouldn't this just render the short url ban completely useless? Couldn't people still use this maliciously to bypass the ban?
    – MrMythical
    Commented Mar 1, 2022 at 14:30
  • @MrMythical It does demonstrate what's used to test for URL shorteners is not completely effective. OTOH, it's clear from the fact that the URLs in the question are blocked, and that some other shorteners aren't blocked, that some issues should be addressed. As I understand it, the blocks are regular expression based. It's more complicated, but certainly possible, to account for percent encoding in a regex (done it for some SmokeDetector regexes). It is, however, easier, faster, and more generic to deal with percent encoding in other ways (e.g. by preprocessing the text to convert them).
    – Makyen Mod
    Commented Mar 1, 2022 at 15:18
  • 1
    That is if the goal really is to cover all cases. If that is the goal, it's not currently met. From what's implemented, the goal seems to be to cover the vast majority of cases with, hopefully, a small impact on legitimate uses. My hope would be that a feature-request or bug would be handled by SE to improve the detection to handle both the issue that it's erroneously detecting the URLs here and to handle the potential avoidance of detection by using percent encoding.
    – Makyen Mod
    Commented Mar 1, 2022 at 15:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .