diff options
| -rw-r--r-- | go.mod | 2 | ||||
| -rw-r--r-- | go.sum | 4 | ||||
| -rw-r--r-- | http_server.go | 10 |
3 files changed, 13 insertions, 3 deletions
@@ -8,7 +8,7 @@ go 1.20 require ( git.sr.ht/~shulhan/ciigo v0.10.1 github.com/evanw/esbuild v0.19.8 - github.com/shuLhan/share v0.51.0 + github.com/shuLhan/share v0.51.1-0.20231208192030-ed9a59261448 ) require ( @@ -4,8 +4,8 @@ git.sr.ht/~shulhan/ciigo v0.10.1 h1:J/lZ9Xqretky2fgC0g8Z5HATNqEWWDFkSKUBLyFm83g= git.sr.ht/~shulhan/ciigo v0.10.1/go.mod h1:q6VQ+us4sErIfB0jk4F+VsSBLYK/k9T41X2loC9CBLw= github.com/evanw/esbuild v0.19.8 h1:IJ1CRsv3i4dkjPLo6NEGTMI0DDba7jOlPc6JFzIxtl4= github.com/evanw/esbuild v0.19.8/go.mod h1:D2vIQZqV/vIf/VRHtViaUtViZmG7o+kKmlBfVQuRi48= -github.com/shuLhan/share v0.51.0 h1:WPKRNNWnZPaVTi/o6nUdkAePek2Lbjz5baoq8MU1U+I= -github.com/shuLhan/share v0.51.0/go.mod h1:Zn0zwUdSuu7L2BKaYkVOXwbwxd5Kn6Y2bhohD9Tf0Sc= +github.com/shuLhan/share v0.51.1-0.20231208192030-ed9a59261448 h1:NYa3OAbJ5R0ZIMhHOfbln+DPyAwPBKFwWZwPA8IDhTg= +github.com/shuLhan/share v0.51.1-0.20231208192030-ed9a59261448/go.mod h1:Zn0zwUdSuu7L2BKaYkVOXwbwxd5Kn6Y2bhohD9Tf0Sc= github.com/yuin/goldmark v1.6.0 h1:boZcn2GTjpsynOsC0iJHnBWa4Bi0qzfJjthwauItG68= github.com/yuin/goldmark v1.6.0/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= diff --git a/http_server.go b/http_server.go index 30fe53a..e83cb2f 100644 --- a/http_server.go +++ b/http_server.go @@ -4,6 +4,7 @@ package awwan import ( + "bytes" "encoding/json" "errors" "fmt" @@ -408,6 +409,15 @@ func (httpd *httpServer) FSGet(epr *libhttp.EndpointRequest) (resb []byte, err e } return nil, err } + if node.IsDir() { + var buf bytes.Buffer + fmt.Fprint(&buf, `{"code":200,"data":`) + resb, _ = node.JSON(0, false, false) + buf.Write(resb) + buf.WriteByte('}') + resb = buf.Bytes() + return resb, nil + } res.Code = http.StatusOK res.Data = node |
