5a09a48b2d
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.
18 lines
342 B
Go
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
|
|
}
|