From 7299212a425d6c4a2df93ec4633ba1e1b7a5b9be Mon Sep 17 00:00:00 2001 From: Sean Liao Date: Fri, 12 Jul 2024 20:14:23 +0100 Subject: [PATCH] net/http: match os.File.Readdir behavior in DotFileHiding Fixes #67697 Change-Id: I26b26262d885d0704851c08c79e7b2b4872b65ad Reviewed-on: https://go-review.googlesource.com/c/go/+/598075 LUCI-TryBot-Result: Go LUCI Reviewed-by: Damien Neil Reviewed-by: Cherry Mui --- src/net/http/example_filesystem_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/net/http/example_filesystem_test.go b/src/net/http/example_filesystem_test.go index 0e81458a07..ebcb994f43 100644 --- a/src/net/http/example_filesystem_test.go +++ b/src/net/http/example_filesystem_test.go @@ -5,6 +5,7 @@ package http_test import ( + "io" "io/fs" "log" "net/http" @@ -40,6 +41,9 @@ func (f dotFileHidingFile) Readdir(n int) (fis []fs.FileInfo, err error) { fis = append(fis, file) } } + if err == nil && n > 0 && len(fis) == 0 { + err = io.EOF + } return } -- 2.48.1