aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-03-09 21:50:28 -0500
committercel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519>2017-03-09 22:22:52 -0500
commit99a90e6ae99bee6d2444a36c8a4b555d54e8b62e (patch)
tree56142983541c27f73910afc21093677f1a01cc1b
parente90c21e476f4116f6ea58ba854766583cda3c531 (diff)
downloadpatchfoo-99a90e6ae99bee6d2444a36c8a4b555d54e8b62e.tar.gz
patchfoo-99a90e6ae99bee6d2444a36c8a4b555d54e8b62e.zip
Don't linkify bare blob or msg mentions
-rw-r--r--lib/render.js8
-rw-r--r--lib/serve.js2
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