Skip to content

Commit 62c5573

Browse files
committed
fix: error if --raw-leaves with --cid-version=0 is set
1 parent 099ce9c commit 62c5573

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

core/commands/add.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,11 @@ See 'dag export' and 'dag import' for more information.
226226
hashFunStr = cfg.Import.HashFunction.WithDefault(config.DefaultHashFunction)
227227
}
228228

229+
// Check if --raw-leaves and --cid-version=0 are set together before checking Config.Import
230+
if rbset && rawblks && cidVerSet && cidVer == 0 {
231+
return errors.New("unixfs raw leaves require cid version 1")
232+
}
233+
229234
if !cidVerSet && !cfg.Import.CidVersion.IsDefault() {
230235
cidVerSet = true
231236
cidVer = int(cfg.Import.CidVersion.WithDefault(config.DefaultCidVersion))

0 commit comments

Comments
 (0)