Skip to content

Commit

Permalink
fix the content disposition header
Browse files Browse the repository at this point in the history
* needs a name parameter
* "file" isn't a valid disposition

see https://github.com/ipfs/ipfs/issues/395
  • Loading branch information
Stebalien committed Mar 20, 2019
1 parent 98673cc commit cff97fc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion multifilereader.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ func (mfr *MultiFileReader) Read(buf []byte) (written int, err error) {
// write the boundary and headers
header := make(textproto.MIMEHeader)
filename := url.QueryEscape(path.Join(path.Join(mfr.path...), entry.Name()))
header.Set("Content-Disposition", fmt.Sprintf("file; filename=\"%s\"", filename))
dispositionPrefix := "attachment"
if mfr.form {
dispositionPrefix = "form-data; name=\"file\""
}

header.Set("Content-Disposition", fmt.Sprintf("%s; filename=\"%s\"", dispositionPrefix, filename))

var contentType string

Expand Down

0 comments on commit cff97fc

Please sign in to comment.