Browse Source

notfounds in blob: protocol now register blob-want

Paul Frazee 5 years ago
parent
commit
4d9510336a
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      app/lib/blobs.js

+ 4
- 1
app/lib/blobs.js View File

@@ -7,8 +7,10 @@ var toPull      = require('stream-to-pull-stream')
7 7
 var querystring = require('querystring')
8 8
 var fs          = require('fs')
9 9
 
10
-module.exports = function (blobs_dir, checkout_dir) {
10
+module.exports = function (sbot, checkout_dir) {
11
+  var blobs_dir = path.join(sbot.config.path, 'blobs')
11 12
   var fallback_img_path = path.join(__dirname, '../../node_modules/ssbplug-phoenix/img/default-prof-pic.png')
13
+  var nowaitOpts = { nowait: true }, id = function(){}
12 14
 
13 15
   return {
14 16
     // behavior for the blob: protocol
@@ -24,6 +26,7 @@ module.exports = function (blobs_dir, checkout_dir) {
24 26
           return new protocol.RequestFileJob(filepath)
25 27
         } catch (e) {
26 28
           // notfound
29
+          sbot.blobs.want(parsed.hash, nowaitOpts, id)
27 30
           if (parsed.qs.fallback == 'img')
28 31
             return new protocol.RequestFileJob(fallback_img_path)
29 32
           return new protocol.RequestErrorJob(-6)

Loading…
Cancel
Save