mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-05-30 07:54:23 +03:00
Fix http.FileServer short write
This commit is contained in:
18
experimental/clashapi/server_fs.go
Normal file
18
experimental/clashapi/server_fs.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user