Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fs: handle Readdir(0) same as Readdir(< 0) #69

Merged
merged 1 commit into from Jul 9, 2019

Conversation

Projects
None yet
2 participants
@dmitshur
Copy link
Contributor

commented Jul 8, 2019

Implementations of the File.Readdir method are expected to treat
all n <= 0 values the same, returning all the os.FileInfo structures
from the directory in a single slice. This is documented at
https://godoc.org/net/http#File.Readdir and https://godoc.org/os#File.Readdir.

Previously, the n == 0 value was not being handled correctly.
This change fixes it by making it work the same as all other
negative values of n.

Add a test case for it.

Also simplify string(out.Bytes()) to just out.String() in a test.

Fixes #68.
Fixes shurcooL/httpfs#8.
Closes shurcooL/httpfs#9.

fs: handle Readdir(0) same as Readdir(< 0)
Implementations of the File.Readdir method are expected to treat
all n <= 0 values the same, returning all the os.FileInfo structures
from the directory in a single slice. This is documented at
https://godoc.org/net/http#File.Readdir and https://godoc.org/os#File.Readdir.

Previously, the n == 0 value was not being handled correctly.
This change fixes it by making it work the same as all other
negative values of n.

Add a test case for it.

Also simplify string(out.Bytes()) to just out.String() in a test.

Fixes #68.
Fixes shurcooL/httpfs#8.
Closes shurcooL/httpfs#9.

@dmitshur dmitshur changed the title fs: treat Readdir(0) same as Readdir(< 0) fs: handle Readdir(0) same as Readdir(< 0) Jul 8, 2019

@rakyll

rakyll approved these changes Jul 9, 2019

@rakyll rakyll merged commit 28d0e00 into rakyll:master Jul 9, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@rakyll

This comment has been minimized.

Copy link
Owner

commented Jul 9, 2019

Thanks!

@dmitshur

This comment has been minimized.

Copy link
Contributor Author

commented Jul 9, 2019

Thanks for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.