Commit 2e582bd1dc0e9a6709bc4eab94124e250aa64945
Don't linkify bad refs
cel committed on 8/24/2018, 12:41:18 AMParent: 9357a5e729bcc1b6addd132bf1c7a860b13364d5
Files changed
render.js | changed |
render.js | |||
---|---|---|---|
@@ -4,8 +4,9 @@ | |||
4 | 4 … | var htime = require("human-time"); | |
5 | 5 … | var emojis = require("emoji-named-characters"); | |
6 | 6 … | var cat = require("pull-cat"); | |
7 | 7 … | var h = require('hyperscript'); | |
8 … | +var refs = require('ssb-ref') | ||
8 | 9 … | ||
9 | 10 … | var emojiDir = path.join(require.resolve("emoji-named-characters"), "../pngs"); | |
10 | 11 … | ||
11 | 12 … | exports.wrapPage = wrapPage; | |
@@ -30,13 +31,16 @@ | |||
30 | 31 … | switch (href[0]) { | |
31 | 32 … | case "#": | |
32 | 33 … | return this.opts.base + "channel/" + href.slice(1); | |
33 | 34 … | case "%": | |
35 … | + if (!refs.isMsgId(href)) return false | ||
34 | 36 … | return this.opts.msg_base + encodeURIComponent(href); | |
35 | 37 … | case "@": | |
38 … | + if (!refs.isFeedId(href)) return false | ||
36 | 39 … | href = (this.opts.mentions && this.opts.mentions[href.substr(1)]) || href; | |
37 | 40 … | return this.opts.feed_base + href; | |
38 | 41 … | case "&": | |
42 … | + if (!refs.isBlobId(href)) return false | ||
39 | 43 … | return this.opts.blob_base + href; | |
40 | 44 … | } | |
41 | 45 … | if (href.indexOf("javascript:") === 0) return false; | |
42 | 46 … | return href; |
Built with git-ssb-web