Skip to content

Commit

Permalink
Fix gateway handling of sharded directories
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
  • Loading branch information
whyrusleeping committed Apr 29, 2017
1 parent e5529cd commit b71ef83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions test/sharness/t0260-sharding-flag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ test_expect_success "sharded and unsharded output look the same" '
test_cmp sharded_out unsharded_out
'

test_expect_success "ipfs cat error output the same" '
test_expect_code 1 ipfs cat "$SHARDED" 2> sharded_err &&
test_expect_code 1 ipfs cat "$UNSHARDED" 2> unsharded_err &&
test_cmp sharded_err unsharded_err
'

test_add_large_dir_v1() {
exphash="$1"
test_expect_success "ipfs add (CIDv1) on very large directory succeeds" '
Expand Down
2 changes: 1 addition & 1 deletion unixfs/io/dagreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewDagReader(ctx context.Context, n node.Node, serv mdag.DAGService) (DagRe
}

switch pb.GetType() {
case ftpb.Data_Directory:
case ftpb.Data_Directory, ftpb.Data_HAMTShard:
// Dont allow reading directories
return nil, ErrIsDir
case ftpb.Data_File, ftpb.Data_Raw:
Expand Down

0 comments on commit b71ef83

Please sign in to comment.