# Broken links (blank page) with invalid URLs with double #

**URL:** https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640
**Category:** Support
**Created:** [11월 7, 2016, 8:37오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640 "2016-11-07T20:37:37Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![frabrunelle](https://avatars.discourse-cdn.com/v4/letter/f/7ba0ec/32.png) [@frabrunelle](https://meta.discourse.org/u/frabrunelle)
#### Post date: [11월 7, 2016, 8:37오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/1 "2016-11-07T20:37:37Z")

</div>

Earlier today, I posted a topic and I noticed that there was an issue with some of the links:

[https://safenetforum.org/t/matrix-riot-slack-irc-freenode/11711](https://safenetforum.org/t/matrix-riot-slack-irc-freenode/11711)

The first two links inside that topic were broken:

> **[Element](https://riot.im/app/#/room/%23safenetwork:matrix.org)**

> **[Element](https://riot.im/app/#/room/%23safenetwork-dev:matrix.org)**

If you right click on the link and open it in a new tab, it works fine. But if you do a normal click on the link, it brings you to a blank page with the following URL: [https://safenetforum.org/clicks/track?url=https%3A%2F%2Friot.im%2Fapp%2F%23%2Froom%2F%23safenetwork%3Amatrix.org&post\_id=105936&topic\_id=11711](https://safenetforum.org/clicks/track?url=https%3A%2F%2Friot.im%2Fapp%2F%23%2Froom%2F%23safenetwork%3Amatrix.org&post_id=105936&topic_id=11711)

I found a temporary fix: if I link to [Element](https://riot.im/app/#/room/%23safenetwork:matrix.org) (%23 instead of #) it works fine! but I would still like to be able to use the normal link if possible 🙂 thank you!

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11월 7, 2016, 9:56오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/2 "2016-11-07T21:56:31Z")

</div>

Is there anything we can do here @eviltrout?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [11월 10, 2016, 4:42오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/3 "2016-11-10T16:42:26Z")

</div>

Hmmm, the problem here seems to be that Ruby can’t parse those URLs:

```ruby
URI.parse("https://riot.im/app/#/room/#safenetwork:matrix.org")
URI::InvalidURIError: bad URI(is not URI?): https://riot.im/app/#/room/#safenetwork:matrix.org

```

It honestly seems a bit odd to me to have two hashes in a URL like that.

---

<div class="post-metadata">

### Author: ![Stefan\_Fairphone](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stefan_fairphone/32/119580_2.png) [@Stefan\_Fairphone](https://meta.discourse.org/u/Stefan_Fairphone)
#### Post date: [3월 31, 2017, 5:07오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/4 "2017-03-31T17:07:51Z")

</div>

> [@eviltrout](#):
>
> It honestly seems a bit odd to me to have two hashes in a URL like that.

It honestly seems a bit odd to me that I can’t forward our forum population to our Matrix chatroom. 😉 Seriously: If Firefox can open those links, Discourse/Ruby should be able to do it as well.

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [3월 31, 2017, 5:12오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/5 "2017-03-31T17:12:15Z")

</div>

> [@Stefan\_Fairphone](#):
>
> It honestly seems a bit odd to me that I can’t forward our forum population to our Matrix chatroom.

Is this a valid URL per the RFC? If not, it’s odd that a new protocol is based on invalid URLs.

Also, it should work if you encode according to the spec: [Element](https://riot.im/app/#/room/%23safenetwork:matrix.org)

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [3월 31, 2017, 5:12오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/6 "2017-03-31T17:12:40Z")

</div>

According to [this stack overflow answer](http://stackoverflow.com/a/4715958) a fragment is not allowed to contain `#`, and so Ruby’s internal URI processor is correct.

It’s cool that Firefox allows it, but it would be quite a lot of work to audit our codebase and find all the places where we parse URIs and allow for this special case.

---

<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: [3월 31, 2017, 5:14오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/7 "2017-03-31T17:14:20Z")

</div>

It is an invalid URI you have there, riot should be the one fixing this strange scheme 🙂

Is there a bug report somewhere in the relevant riot issue tracker you raised?

EDIT: triple ninjad here…

Issue tracker for riot is ➡ [GitHub - element-hq/element-web: A glossy Matrix collaboration client for the web. · GitHub](https://github.com/vector-im/riot-web)

---

<div class="post-metadata">

### Author: ![Stefan\_Fairphone](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stefan_fairphone/32/119580_2.png) [@Stefan\_Fairphone](https://meta.discourse.org/u/Stefan_Fairphone)
#### Post date: [3월 31, 2017, 5:19오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/8 "2017-03-31T17:19:44Z")

</div>

It’s not Riot itself, but actually a Matrix convention:

> **[You're invited to talk on Matrix](https://matrix.to/#/%23wearefairphone:matrix.org)**
>
> You're invited to talk on Matrix. If you don't already have a client this link will help you pick one, and join the conversation. If you already have one, this link will help you join the conversation

Will try to raise the issue with them.

Edit: You can follow the discussion here:

> **[You're invited to talk on Matrix](https://matrix.to/#/!cURbafjkfsMDVwdRDQ:matrix.org/$14909817704630VDcMZ:disroot.org)**
>
> You're invited to talk on Matrix. If you don't already have a client this link will help you pick one, and join the conversation. If you already have one, this link will help you join the conversation

~~(Copy the link to your browser address bar. 😛 )~~ Direct link to a message does work in Discourse, apparently… 😉

---

<div class="post-metadata">

### Author: ![ara4n](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@ara4n](https://meta.discourse.org/u/ara4n)
#### Post date: [3월 31, 2017, 5:42오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/9 "2017-03-31T17:42:59Z")

</div>

Hey, project lead for Matrix here. Yup, we’re aware that it’s a bit naughty to put unescaped #'s in URL fragments, but in practice this is the first time in two years we’ve seen anyone actually hitting it as a bug! The workaround is of course to escape it properly as %23.

We’ll have a think about the right way to fix this - perhaps we should switch to using [Unicode Character 'VIEWDATA SQUARE' (U+2317)](http://www.fileformat.info/info/unicode/char/2317/index.htm) instead O:-)

In the interim it might be kind to consider tweaking your parser to be slightly more forgiving on what it accepts however, in accordance with Postel’s law.

In other news, I can’t wait for someone to implement a Discourse\<-\>Matrix bridge, rather than clunky hyperlinking between the two!

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [3월 31, 2017, 5:45오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/10 "2017-03-31T17:45:17Z")

</div>

> [@ara4n](#):
>
> In the interim it might be kind to consider tweaking your parser to be slightly more forgiving on what it accepts however, in accordance with Postel’s law.

The problem is that the parser in question is the Ruby Standard Library one.[quote=“ara4n, post:9, topic:52640”]  
In other news, I can’t wait for someone to implement a Discourse\<-\>Matrix bridge, rather than clunky hyperlinking between the two!  
[/quote]

This will be way easier when this plugin is live:

> [@Common event system for chatrooms - a specification](https://meta.discourse.org/t/common-event-system-for-chatrooms-a-specification/59245):
>
> One of the GSOC ideas on GitHub is creating a “[Common Event System for Chatrooms](https://github.com/discourse/discourse/wiki/Summer-of-Code-2017-Ideas-List#common-event-system-for-chatrooms)” I like the sound of this idea, so this is an attempt at a more comprehensive description of how it could be implemented. Hopefully this will give a starting point for some discussion about what people would like to get out of a feature like this. Edit 17/03/2017: I've added and removed some stuff based on comments below. What we already have [https://meta.discourse.org/t/the-official-discourse-slack-plugin/5141…](https://meta.discourse.org/t/the-official-discourse-slack-plugin/51412)

---

<div class="post-metadata">

### Author: ![ara4n](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@ara4n](https://meta.discourse.org/u/ara4n)
#### Post date: [3월 31, 2017, 6:12오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/11 "2017-03-31T18:12:17Z")

</div>

another workaround might be to use the intended minimal URL form for matrix.to URLs - [You're invited to talk on Matrix](https://matrix.to/#matrix:matrix.org) is meant to work and ‘do the right thing’ (but isn’t implemented yet: [Support links without the # anonymiser · Issue #10 · matrix-org/matrix.to · GitHub](http://github.com/matrix-org/matrix.to/issues/10)).

However, it also commits a slight naughtiness by hoping to produce user links that look like [You're invited to talk on Matrix](https://matrix.to/@matthew:matrix.org). Technically you’re meant to escape @ symbols in URL paths too. Can someone confirm if Ruby’s URL parser chokes on the unescaped @?

---

<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: [3월 31, 2017, 6:18오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/12 "2017-03-31T18:18:35Z")

</div>

> [@ara4n](#):
>
> Can someone confirm if Ruby’s URL parser chokes on the unescaped @?

The link works here without throwing an error, so it seems to support it.

---

<div class="post-metadata">

### Author: ![ara4n](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@ara4n](https://meta.discourse.org/u/ara4n)
#### Post date: [3월 31, 2017, 6:25오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/13 "2017-03-31T18:25:41Z")

</div>

fab. in which case i think we’ll have a viable workaround once someone fixes [Support links without the # anonymiser · Issue #10 · matrix-org/matrix.to · GitHub](https://github.com/matrix-org/matrix.to/issues/10) - and meanwhile [Room URLs are technically invalid · Issue #1903 · element-hq/element-meta · GitHub](https://github.com/vector-im/riot-web/issues/3550) has been filed to fix Riot’s native URLs.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [3월 31, 2017, 9:01오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/14 "2017-03-31T21:01:16Z")

</div>

Honestly the best thing is for you guys to fix your stuff, which you’re here and doing, so 👍 cheers for that.

---

<div class="post-metadata">

### Author: ![ara4n](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@ara4n](https://meta.discourse.org/u/ara4n)
#### Post date: [3월 31, 2017, 9:04오후 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/15 "2017-03-31T21:04:01Z")

</div>

for sure. just seems a bit weird that the Ruby parser is being more unforgiving than any other one we’ve encountered. I’m pretty sure we’re not the only people out there who cheat on escaping some inoffensive URL characters in order to make their URLs look prettier… I wonder whether the story here is actually that the Ruby parser just needs a greedy matcher when looking for #'s or something.

edit: eitherway, we’re fixing it, as you say 🙂

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [5월 21, 2019, 12:46오전 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/16 "2019-05-21T00:46:57Z")

</div>



---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [5월 21, 2019, 4:04오전 UTC](https://meta.discourse.org/t/broken-links-blank-page-with-invalid-urls-with-double/52640/17 "2019-05-21T04:04:36Z")

</div>


