Commit 2fca45e4496fc0ac936fb38aa08eadd7aa9de703
only generate blob urls if valid blob ID passed
Matt McKegg committed on 5/18/2018, 5:52:15 AMParent: 3005b194df65a28b27f0ee8583b9f3dc9b821f70
Files changed
plugs/blob/sync/url.js | changed |
plugs/blob/sync/url.js | |||
---|---|---|---|
@@ -1,5 +1,6 @@ | |||
1 | 1 … | var nest = require('depnest') | |
2 … | +var ref = require('ssb-ref') | ||
2 | 3 … | ||
3 | 4 … | exports.needs = nest({ | |
4 | 5 … | 'config.sync.load': 'first' | |
5 | 6 … | }) | |
@@ -12,7 +13,11 @@ | |||
12 | 13 … | var prefix = config.blobsPrefix != null ? config.blobsPrefix : `http://localhost:${config.ws.port}/blobs/get` | |
13 | 14 … | if (link && typeof link.link === 'string') { | |
14 | 15 … | link = link.link | |
15 | 16 … | } | |
16 | - return `${prefix}/${link}` | ||
17 … | + | ||
18 … | + var parsed = ref.parseLink(link) | ||
19 … | + if (parsed && ref.isBlob(parsed.link)) { | ||
20 … | + return `${prefix}/${parsed.link}` | ||
21 … | + } | ||
17 | 22 … | }) | |
18 | 23 … | } |
Built with git-ssb-web