From 99a90e6ae99bee6d2444a36c8a4b555d54e8b62e Mon Sep 17 00:00:00 2001 From: cel Date: Thu, 9 Mar 2017 21:50:28 -0500 Subject: Don't linkify bare blob or msg mentions --- lib/render.js | 8 ++++++-- lib/serve.js | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/render.js b/lib/render.js index 7e24d29..cde359d 100644 --- a/lib/render.js +++ b/lib/render.js @@ -106,11 +106,15 @@ Render.prototype.toUrl = function (href) { if (mentions && href in this._mentions) href = this._mentions[href] if (/^ssb:\/\//.test(href)) href = href.substr(6) switch (href[0]) { - case '%': return this.opts.base + encodeURIComponent(href) + case '%': + if (!u.isRef(href)) return false + return this.opts.base + encodeURIComponent(href) case '@': if (!u.isRef(href)) return false return this.opts.base + href - case '&': return this.opts.blob_base + href + case '&': + if (!u.isRef(href)) return false + return this.opts.blob_base + href case '#': return this.opts.base + encodeURIComponent(href) case '/': return this.opts.base + href.substr(1) case '?': return this.opts.base + 'search?q=' + encodeURIComponent(href) diff --git a/lib/serve.js b/lib/serve.js index fcc737e..c3ceee7 100644 --- a/lib/serve.js +++ b/lib/serve.js @@ -904,7 +904,7 @@ Serve.prototype.composer = function (opts, cb) { mention.size = blob.size if (blob.type && blob.type !== 'application/octet-stream') mention.type = blob.type - } else if (/^[@%&]$/.test(mention.link)) { + } else if (mention.link === '@') { // bare mention var name = mention.name var fullName = mention.link + name -- cgit v1.2.3