# Adding an external link to the Reason field (badge) fails silently

**URL:** https://meta.discourse.org/t/adding-an-external-link-to-the-reason-field-badge-fails-silently/95847
**Category:** Bug
**Created:** [28 באוגוסט,‏ 2018,‏ 4:58pm UTC](https://meta.discourse.org/t/adding-an-external-link-to-the-reason-field-badge-fails-silently/95847 "2018-08-28T16:58:29Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [28 באוגוסט,‏ 2018,‏ 4:58pm UTC](https://meta.discourse.org/t/adding-an-external-link-to-the-reason-field-badge-fails-silently/95847/1 "2018-08-28T16:58:29Z")

</div>

Repro on Meta:

1. go to user admin page
2. click on Edit badges
3. assign a badge adding an external URL as Reason  
 ![2018-08-28_18-46-16](https://global.discourse-cdn.com/meta/original/3X/c/8/c8ec8b119c7552105defbd512e7e0d4bd15be484.png)
4. click Grant
5. the badge is assigned, the Reason field remains empty  
 ![image](https://global.discourse-cdn.com/meta/original/3X/f/0/f0d6bb256cefcf0d196cb4e65c4b70d00b54581f.png)

The admin should be warned that the URL is invalid (is not an internal URL) and clicking on Grant must produce the error `Sorry, an error has occurred` (btw a specific error is always better to identify where you are wrong).

---

<div class="post-metadata">

### Author: ![saurabhp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saurabhp/32/125182_2.png) [@saurabhp](https://meta.discourse.org/u/saurabhp)
#### Post date: [27 בנובמבר,‏ 2018,‏ 12:52pm UTC](https://meta.discourse.org/t/adding-an-external-link-to-the-reason-field-badge-fails-silently/95847/2 "2018-11-27T12:52:34Z")

</div>

Hi,

I can confirm this is the case when using external link. Do we want to throw error on external links? If yes, I can try to work on it.

Thanks

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [27 בנובמבר,‏ 2018,‏ 1:07pm UTC](https://meta.discourse.org/t/adding-an-external-link-to-the-reason-field-badge-fails-silently/95847/3 "2018-11-27T13:07:21Z")

</div>

Yes, because no error is shown when you click on Grant, so the administrators do not understand that they are wrong to insert the link.

---

<div class="post-metadata">

### Author: ![saurabhp](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saurabhp/32/125182_2.png) [@saurabhp](https://meta.discourse.org/u/saurabhp)
#### Post date: [28 בנובמבר,‏ 2018,‏ 8:25am UTC](https://meta.discourse.org/t/adding-an-external-link-to-the-reason-field-badge-fails-silently/95847/4 "2018-11-28T08:25:16Z")

</div>

Hi @dax ,  
I have created PR for the same. I just wanted to confirm only links have to be allowed in reason, right? Plain text is also not valid, right?

[https://github.com/discourse/discourse/pull/6690](https://github.com/discourse/discourse/pull/6690)

Thanks

---

<div class="post-metadata">

### Author: ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)
#### Post date: [28 בנובמבר,‏ 2018,‏ 9:12am UTC](https://meta.discourse.org/t/adding-an-external-link-to-the-reason-field-badge-fails-silently/95847/5 "2018-11-28T09:12:45Z")

</div>

The only valid links are internal links to posts and topics, so no plain text.  
Thanks, our engineers will review the PR soon.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [28 בנובמבר,‏ 2018,‏ 5:02pm UTC](https://meta.discourse.org/t/adding-an-external-link-to-the-reason-field-badge-fails-silently/95847/6 "2018-11-28T17:02:29Z")

</div>

PR has now been merged 👌

---

<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: [29 בנובמבר,‏ 2018,‏ 11:02pm UTC](https://meta.discourse.org/t/adding-an-external-link-to-the-reason-field-badge-fails-silently/95847/7 "2018-11-29T23:02:43Z")

</div>


