git ssb

10+

Matt McKegg / patchwork



Commit 2fca45e4496fc0ac936fb38aa08eadd7aa9de703

only generate blob urls if valid blob ID passed

Matt McKegg committed on 5/18/2018, 5:52:15 AM
Parent: 3005b194df65a28b27f0ee8583b9f3dc9b821f70

Files changed

plugs/blob/sync/url.jschanged
plugs/blob/sync/url.jsView
@@ -1,5 +1,6 @@
11 var nest = require('depnest')
2 +var ref = require('ssb-ref')
23
34 exports.needs = nest({
45 'config.sync.load': 'first'
56 })
@@ -12,7 +13,11 @@
1213 var prefix = config.blobsPrefix != null ? config.blobsPrefix : `http://localhost:${config.ws.port}/blobs/get`
1314 if (link && typeof link.link === 'string') {
1415 link = link.link
1516 }
16- return `${prefix}/${link}`
17 +
18 + var parsed = ref.parseLink(link)
19 + if (parsed && ref.isBlob(parsed.link)) {
20 + return `${prefix}/${parsed.link}`
21 + }
1722 })
1823 }

Built with git-ssb-web