From 4d9510336a530520373cb088cb423c02e29d89a4 Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Sat, 4 Jul 2015 13:51:33 -0500 Subject: [PATCH] notfounds in blob: protocol now register blob-want --- app/lib/blobs.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/lib/blobs.js b/app/lib/blobs.js index 0c08aa7..96db365 100644 --- a/app/lib/blobs.js +++ b/app/lib/blobs.js @@ -7,8 +7,10 @@ var toPull = require('stream-to-pull-stream') var querystring = require('querystring') var fs = require('fs') -module.exports = function (blobs_dir, checkout_dir) { +module.exports = function (sbot, checkout_dir) { + var blobs_dir = path.join(sbot.config.path, 'blobs') var fallback_img_path = path.join(__dirname, '../../node_modules/ssbplug-phoenix/img/default-prof-pic.png') + var nowaitOpts = { nowait: true }, id = function(){} return { // behavior for the blob: protocol @@ -24,6 +26,7 @@ module.exports = function (blobs_dir, checkout_dir) { return new protocol.RequestFileJob(filepath) } catch (e) { // notfound + sbot.blobs.want(parsed.hash, nowaitOpts, id) if (parsed.qs.fallback == 'img') return new protocol.RequestFileJob(fallback_img_path) return new protocol.RequestErrorJob(-6)