mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
cleanup multipart
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
parent
a9d6575b7c
commit
9c641f9906
@ -96,7 +96,6 @@ func (c *client) Send(req cmds.Request) (cmds.Response, error) {
|
||||
// TODO extract string consts?
|
||||
if fileReader != nil {
|
||||
httpReq.Header.Set(contentTypeHeader, "multipart/form-data; boundary="+fileReader.Boundary())
|
||||
httpReq.Header.Set(contentDispHeader, "form-data: name=\"files\"")
|
||||
} else {
|
||||
httpReq.Header.Set(contentTypeHeader, applicationOctetStream)
|
||||
}
|
||||
|
||||
@ -92,12 +92,7 @@ func (mfr *MultiFileReader) Read(buf []byte) (written int, err error) {
|
||||
// write the boundary and headers
|
||||
header := make(textproto.MIMEHeader)
|
||||
filename := url.QueryEscape(file.FileName())
|
||||
if mfr.form {
|
||||
contentDisposition := fmt.Sprintf("form-data; name=\"file\"; filename=\"%s\"", filename)
|
||||
header.Set("Content-Disposition", contentDisposition)
|
||||
} else {
|
||||
header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename))
|
||||
}
|
||||
header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename))
|
||||
|
||||
header.Set("Content-Type", contentType)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user