diff options
author | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-09-29 08:41:55 -1000 |
---|---|---|
committer | cel <cel@f/6sQ6d2CMxRUhLpspgGIulDxDCwYD7DzFzPNr7u5AU=.ed25519> | 2017-09-29 08:41:55 -1000 |
commit | 440274d19f302e0f293d56cba685e39e372cda12 (patch) | |
tree | 5bcd754ab04f5080aaf353dfc2b60b5fac7edb31 /lib/render.js | |
parent | 7fffac329b2718f0ea918cd9fd53d3e2b47cc93e (diff) | |
parent | 62e7e74bd278473cc4358700b7f2b5c0a78ac681 (diff) | |
download | patchfoo-440274d19f302e0f293d56cba685e39e372cda12.tar.gz patchfoo-440274d19f302e0f293d56cba685e39e372cda12.zip |
Merge branch 'secretblobs' into master
Diffstat (limited to 'lib/render.js')
-rw-r--r-- | lib/render.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/render.js b/lib/render.js index d7fe04f..cc08259 100644 --- a/lib/render.js +++ b/lib/render.js @@ -136,7 +136,7 @@ Render.prototype.markdown = function (text, mentions) { else if (link.host === 'http://localhost:7777') mentionsObj[link.href] = link.link if (link.link) - mentionsByLink[link.link] = link + mentionsByLink[link.link + (link.key ? '#' + link.key : '')] = link }) var out = marked(String(text), this.markedOpts) delete this._mentions @@ -147,6 +147,7 @@ Render.prototype.markdown = function (text, mentions) { Render.prototype.imageUrl = function (ref) { var m = /^blobstore:(.*)/.exec(ref) if (m) ref = m[1] + ref = ref.replace(/#/, '%23') return this.opts.img_base + 'image/' + ref } @@ -196,8 +197,14 @@ Render.prototype.toUrl = function (href) { if (!u.isRef(href)) return false return this.opts.base + href case '&': - if (!u.isRef(href)) return false - return this.opts.blob_base + href + var parts = href.split('#') + var hash = parts.shift() + var key = parts.shift() + var fragment = parts.join('#') + if (!u.isRef(hash)) return false + return this.opts.blob_base + hash + + (key ? encodeURIComponent('#' + key) : '') + + (fragment ? '#' + fragment : '') case '#': return this.opts.base + 'channel/' + encodeURIComponent(href.substr(1)) case '/': return this.opts.base + href.substr(1) |