# Censored words out of a URL

**URL:** https://meta.discourse.org/t/censored-words-out-of-a-url/43154
**Category:** Bug
**Tags:** markdown-it-review
**Created:** [25 april 2016 om 04:39 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154 "2016-04-25T04:39:19Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![jesselperry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jesselperry/32/119501_2.png) [@jesselperry](https://meta.discourse.org/u/jesselperry)
#### Post date: [25 april 2016 om 04:39 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/1 "2016-04-25T04:39:19Z")

</div>

Not sure if this should be classified as a bug, or intended. But I noticed that Discourse will censor out censored words from a URL, even when it’s not shown. So if someone links to something that contains a censored word, but they link it through the hyperlink button — Discourse will still censor out the words and mess up the link.

For that matter, perhaps the censored word feature shouldn’t mess with URLs at all, even if they do show? Or if a URL contains a censored word, hide the URL altogether, but just force a hyperlink to it?

All minutiae I’m not sure the answer to…

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [25 april 2016 om 04:44 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/2 "2016-04-25T04:44:02Z")

</div>

How big of a list of censored words do you have?  
And are they interfering with legimate URLs?

If so, perhaps you can come up with something more specific to differentiate them.

Example?

---

<div class="post-metadata">

### Author: ![jesselperry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jesselperry/32/119501_2.png) [@jesselperry](https://meta.discourse.org/u/jesselperry)
#### Post date: [25 april 2016 om 05:02 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/3 "2016-04-25T05:02:49Z")

</div>

The URL had Moby-Dick in the title. Which as I type this, I realize that’s a poor thought out censored word.

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [25 april 2016 om 05:14 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/4 "2016-04-25T05:14:07Z")

</div>

Well, Dick can certainly be used legitimately.

It’s all about context.

For example.  
“She lifted his big package”  
could be more offensive than  
“My friend Dick is a Ruby developer”.

> [@jesselperry](#):
>
> poor thought out censored word.

lol I was just going to post something along that line.

I think in this case it would be better to moderate it on an individual context basis.

I was thinking of the classic example “sex” as in [expertsexchange.com](http://expertsexchange.com)  
You wouldn’t want that to come out as a link like expert■■■change.com  
as nice as it might be to foil attempts to link drop online■■■tapes.com

And has been posted in other topics here, the censored word list is not foolproof. Easy enough to post  
Hey D-I-C-K  
There are times when moderation needs to be done.

---

<div class="post-metadata">

### Author: ![jesselperry](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jesselperry/32/119501_2.png) [@jesselperry](https://meta.discourse.org/u/jesselperry)
#### Post date: [25 april 2016 om 05:19 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/5 "2016-04-25T05:19:15Z")

</div>

Thanks for the thoughtful response and clarification! I should tone down the automatic censorship a bit 🙂

---

<div class="post-metadata">

### Author: ![ljpp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ljpp/32/96506_2.png) [@ljpp](https://meta.discourse.org/u/ljpp)
#### Post date: [25 april 2016 om 09:21 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/6 "2016-04-25T09:21:11Z")

</div>

I just encountered this as well. I have blocked about two dozen most offensive curse words of our language, mostly related to sexuality and human anatomy. In our culture these are not considered _civilized discussion_, and we don’t have an age limit for members.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [25 april 2016 om 10:28 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/7 "2016-04-25T10:28:17Z")

</div>

Also, I sort of what to keep censor words working on URLs… We actually use it as a brief way to combat some of the link dropping we get.

We’ve added things like adf.ly to our censor word list as users were trying to use it in a non-community-oriented way, so this way their links would break and it would be obvious to us mods that the link they had was not appropriate (so we should take action on their post).

I’m not saying that is a right solution, but so far, nothing else exists for blocking certain domains. And we wanted something semi-automated, so this fit in nicely.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [26 april 2016 om 04:57 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/8 "2016-04-26T04:57:07Z")

</div>

Certainly nothing should break due to a censored word, the words in the URL are slugs anyway so it should not matter.

What is the exact repro here?

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [26 april 2016 om 05:45 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/9 "2016-04-26T05:45:45Z")

</div>

> [@cpradio](#):
>
> I’m not saying that is a right solution, but so far, nothing else exists for blocking certain domains. And we wanted something semi-automated, so this fit in nicely.

Agreed 100+++%  
Until there is way to censor URLs I hope this approach remains as an alternative.

True, without regex support it can be tricky to come up with something that doesn’t have false positives.  
But it _is_ about the only thing that works so far short of inspecting raw / cooked on a post by post basis to moderate.

… off to look at some more files … 👁

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [27 april 2016 om 04:02 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/10 "2016-04-27T04:02:52Z")

</div>

repro:

1. add `adf.ly` to censored words list
2. post with `http://adf.ly/SpONsoREDliNK`
3. post renders with `<a href="http://■■■■■■/SpONsoREDliNK">http://■■■■■■/SpONsoREDliNK</a>`

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [27 april 2016 om 11:45 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/11 "2016-04-27T11:45:19Z")

</div>

If that changes, can we implement something similar with Screen URLs. We really need this to function, as it was and remains to be a problem for us and censor words was our “workaround”.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [28 april 2016 om 00:41 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/12 "2016-04-28T00:41:22Z")

</div>

> [@cpradio](#):
>
> If that changes, can we implement something similar with Screen URLs. We really need this to function, as it was and remains to be a problem for us and censor words was our “workaround”.

Sorry, just to expand, you are looking for a function that allows you to ban certain domains in hyperlinks… like “you shall never link to `bit.ly`” ? (fair warning, even if implemented there are 🗻s of workaround)

---

<div class="post-metadata">

### Author: ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)
#### Post date: [28 april 2016 om 00:50 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/13 "2016-04-28T00:50:50Z")

</div>

> [@sam](#):
>
> fair warning, even if implemented there are 🗻s of workaround

I’ve tried as many ways as I could think of to get around the current effect of censored word preventing unwanted URLs and could not find any way that resulted in working links.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [28 april 2016 om 00:54 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/14 "2016-04-28T00:54:10Z")

</div>

You simply link to a site that 302s to the URL you are after, like `bit.ly` or family, there are 100s of these sites around.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [28 april 2016 om 01:14 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/15 "2016-04-28T01:14:04Z")

</div>

We ban most of those too. But yes, we have fairly strict policies on links on our site. Shorten URLs are not permitted, which rules out many of them. Plus we’ve had issues in the past with some sites generating 10-50 users over the course of months to find/dredge up topics to offer their services that are in our list.

And yes, we do eventually ban these members, but by stopping their instant gratification of seeing their link in a working order, they do quickly stop trying. Many also use their real URL because they magically believe we’re a “do-follow” site (even though we do utilize the no-follow setting in our install). So for that reason, they typically avoid URL shorteners.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [26 juni 2017 om 19:28 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/16 "2017-06-26T19:28:24Z")

</div>

The censor only applies to text now per:

[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/engines/markdown-it/censored.js.es6#L18-L22](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/engines/markdown-it/censored.js.es6#L18-L22)

fixed in:

> [@CommonMark testing started here!](https://meta.discourse.org/t/commonmark-testing-started-here/65121):
>
> Per our [migration plans](https://meta.discourse.org/t/discourse-commonmark-migration-plans-confetti-ball-balloon), I just enabled [markdown.it](https://github.com/markdown-it/markdown-it) at Meta. It is an excellent [CommonMark](http://commonmark.org/) compliant engine. I expect quite a few edges to be found during this period of testing. Do not open bugs about the new Engine, just reply here. I/we will be updating the top post here with the list of issues and striking out stuff as it is fixed. Current known issues (to be fixed)white_check_mark Onebox vanishes after you start typing and works not-super consistently white_check_mark pending…

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [26 juni 2017 om 19:28 UTC](https://meta.discourse.org/t/censored-words-out-of-a-url/43154/17 "2017-06-26T19:28:57Z")

</div>


