# Some BBCode URLs cannot be handled (contents\[0\].splice is not a function)

**URL:** <https://meta.discourse.org/t/some-bbcode-urls-cannot-be-handled-contents-0-splice-is-not-a-function/47089>\
**Category:** Bug\
**Created:** [11 Luglio 2016, 12:21pm UTC](https://meta.discourse.org/t/some-bbcode-urls-cannot-be-handled-contents-0-splice-is-not-a-function/47089 "2016-07-11T12:21:39Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![palant](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/palant/32/104531_2.png) [@palant](https://meta.discourse.org/u/palant)\
**Post date:** [11 Luglio 2016, 12:21pm UTC](https://meta.discourse.org/t/some-bbcode-urls-cannot-be-handled-contents-0-splice-is-not-a-function/47089/1 "2016-07-11T12:21:39Z")

</div>

The following BBCode will currently produce an exception (reproduced on [try.discourse.org](http://try.discourse.org)):

```
[url]abc.com[/url]

```

The error message in production is “TypeError: e[0].splice is not a function” - this refers to `app/assets/javascripts/discourse/dialects/bbcode_dialect.js`, the `Discourse.BBCode.replaceBBCode('url', ...)` block there. It seems that `contents[0]` is a string but the code attempts to treat it as an array. I didn’t find all the pieces creating this variable, but for some reason this only appears to be an issue if the URL starts with a lower-case letter “a”.

---

_[View the full topic](https://meta.discourse.org/t/some-bbcode-urls-cannot-be-handled-contents-0-splice-is-not-a-function/47089)._
