提交 470d6ba7 作者: Steven Allen

commands(add): fix `ipfs add --nocopy URL` without enabling the filestore

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 337bf0f4
......@@ -5,7 +5,6 @@ import (
"fmt"
"github.com/ipfs/go-ipfs/core"
"github.com/ipfs/go-ipfs/filestore"
"github.com/ipfs/go-ipfs/core/coreunix"
......@@ -49,8 +48,8 @@ func (api *UnixfsAPI) Add(ctx context.Context, files files.Node, opts ...options
// return
//}
if settings.NoCopy && !cfg.Experimental.FilestoreEnabled {
return nil, filestore.ErrFilestoreNotEnabled
if settings.NoCopy && !(cfg.Experimental.FilestoreEnabled || cfg.Experimental.UrlstoreEnabled) {
return nil, fmt.Errorf("either the filestore or the urlstore must be enabled to use nocopy, see: https://git.io/vNItf")
}
addblockstore := api.blockstore
......
......@@ -68,13 +68,24 @@ init_ipfs_filestore() {
test_init_ipfs
# Check the _early_ error message
test_expect_success "nocopy add errors and has right message" '
test_must_fail ipfs add --nocopy -r somedir 2> add_out &&
grep "filestore is not enabled" add_out
grep "either the filestore or the urlstore must be enabled" add_out
'
test_expect_success "enable urlstore config setting" '
ipfs config --json Experimental.UrlstoreEnabled true
'
# Check the _late_ error message
test_expect_success "nocopy add errors and has right message when the urlstore is enabled" '
test_must_fail ipfs add --nocopy -r somedir 2> add_out &&
grep "filestore is not enabled" add_out
'
test_expect_success "enable filestore config setting" '
ipfs config --json Experimental.UrlstoreEnabled true &&
ipfs config --json Experimental.FilestoreEnabled true
'
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论