Skip to content

Commit

Permalink
[bugfix] Avoid Nil Point Dereference on 404 (#717)
Browse files Browse the repository at this point in the history
Netapp ONTAP S3 systems do not return a KeyCount when the requested object doesn't exist. This deserializes as nil and can cause a nil pointer dereference. Checking the pointer for nil first avoids this.
  • Loading branch information
cclose authored Oct 22, 2023
1 parent aa137d7 commit 43a107e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion s3_fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func (fs Fs) statDirectory(name string) (os.FileInfo, error) {
Err: err,
}
}
if *out.KeyCount == 0 && name != "" {
if (out.KeyCount == nil || *out.KeyCount == 0) && name != "" {
return nil, &os.PathError{
Op: "stat",
Path: name,
Expand Down

0 comments on commit 43a107e

Please sign in to comment.