Files
x/handler/file/metadata.go
T
ginuerzh 5a09a48b2d feat: add file upload support for file handler (issue #854)
Add PUT method support to the file:// handler, allowing file uploads via
curl -T. Upload is opt-in, disabled by default — enable with ?put=true
metadata flag. Includes path traversal protection.
2026-05-31 22:48:17 +08:00

18 lines
342 B
Go

package file
import (
mdata "github.com/go-gost/core/metadata"
mdutil "github.com/go-gost/x/metadata/util"
)
type metadata struct {
dir string
put bool
}
func (h *fileHandler) parseMetadata(md mdata.Metadata) (err error) {
h.md.dir = mdutil.GetString(md, "file.dir", "dir")
h.md.put = mdutil.GetBool(md, "file.put", "put")
return
}