aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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