From bd4c244110d8729b732b157fd0d2fda310d4ae33 Mon Sep 17 00:00:00 2001 From: Enrico Fasoli Date: Fri, 5 Feb 2016 17:20:05 +0100 Subject: [PATCH] fix restore from MFS --- lib/boards-api.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/boards-api.js b/lib/boards-api.js index 0c9d40c..a7f13e0 100644 --- a/lib/boards-api.js +++ b/lib/boards-api.js @@ -86,13 +86,17 @@ function BoardsAPI (ipfs) { } BoardsAPI.prototype.restoreProfileFromMFS = function (done) { - this.ipfs.files.stat('/ipfs-boards-profile', (err, res) => { + this.ipfs.files.stat('/ipfs-boards-profile', (err, r) => { if (err) return done(err) - this.ipfs.name.publish(res.Hash, done) + this.ipfs.files.stat('/', (err, res) => { + if (err) return done(err) + this.ipfs.name.publish(res.Hash, done) + }) }) } BoardsAPI.prototype.restoreProfileFromIPFS = function (hash, done) { + // TODO: cp it into mfs or this won't work this.ipfs.name.publish(hash, done) }