Fix http.FileServer short write

This commit is contained in:
世界
2025-02-18 21:52:38 +08:00
parent 28f4fff423
commit 7c6a81ed13
3 changed files with 20 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
package clashapi
import "net/http"
type Dir http.Dir
func (d Dir) Open(name string) (http.File, error) {
file, err := http.Dir(d).Open(name)
if err != nil {
return nil, err
}
return &fileWrapper{file}, nil
}
// workaround for #2345 #2596
type fileWrapper struct {
http.File
}