diff options
Diffstat (limited to 'lib/render.js')
-rw-r--r-- | lib/render.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/render.js b/lib/render.js index 02d7285..2c2278c 100644 --- a/lib/render.js +++ b/lib/render.js @@ -149,13 +149,21 @@ Render.prototype.formatSize = function (size) { } Render.prototype.linkify = function (text) { - var arr = text.split(u.ssbRefRegex) + var arr = text.split(u.ssbRefEncRegex) for (var i = 1; i < arr.length; i += 2) { - arr[i] = h('a', {href: this.toUrl(arr[i])}, arr[i]) + arr[i] = h('a', {href: this.toUrlEnc(arr[i])}, arr[i]) } return arr } +Render.prototype.toUrlEnc = function (href) { + var url = this.toUrl(href) + if (url) return url + try { href = decodeURIComponent(href) } + catch (e) { return false } + return this.toUrl(href) +} + Render.prototype.toUrl = function (href) { if (!href) return href var mentions = this._mentions |