提交 72705564 作者: Jeromy

another type check fix and add back a missing test

License: MIT
Signed-off-by: 's avatarJeromy <why@ipfs.io>
上级 c5318e89
......@@ -290,7 +290,13 @@ func replaceConfig(r repo.Repo, file io.Reader) error {
if err != nil {
return fmt.Errorf("Failed to get PrivKey")
}
cfg.Identity.PrivKey = keyF.Value.(string)
pkstr, ok := keyF.Value.(string)
if !ok {
return fmt.Errorf("private key in config was not a string")
}
cfg.Identity.PrivKey = pkstr
return r.SetConfig(&cfg)
}
......@@ -87,6 +87,10 @@ test_config_cmd() {
test_expect_code 1 ipfs config Identity.PrivKey 2> ident_out
'
test_expect_success "output looks good" '
test_cmp ident_exp ident_out
'
test_expect_success "lower cased PrivKey" '
sed -i -e '\''s/PrivKey/privkey/'\'' "$IPFS_PATH/config" &&
test_expect_code 1 ipfs config Identity.privkey 2> ident_out
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论