Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 27d57c5

Browse files
committed
Add options to block put
Block put is pretty much useless without these options so, IMO, breaking this isn't an issue.
1 parent 88adb78 commit 27d57c5

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

shell.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ func (s *Shell) BlockGet(path string) ([]byte, error) {
670670
return ioutil.ReadAll(resp.Output)
671671
}
672672

673-
func (s *Shell) BlockPut(block []byte) (string, error) {
673+
func (s *Shell) BlockPut(block []byte, format, mhtype string, mhlen int) (string, error) {
674674
data := bytes.NewReader(block)
675675
rc := ioutil.NopCloser(data)
676676
fr := files.NewReaderFile("", "", rc, nil)
@@ -679,6 +679,11 @@ func (s *Shell) BlockPut(block []byte) (string, error) {
679679

680680
req := s.newRequest(context.Background(), "block/put")
681681
req.Body = fileReader
682+
req.Opts = map[string]string{
683+
"mhtype": mhtype,
684+
"mhlen": fmt.Sprintf("%d", mhlen),
685+
"format": format,
686+
}
682687
resp, err := req.Send(s.httpcli)
683688
if err != nil {
684689
return "", err

0 commit comments

Comments
 (0)