Skip to content
This repository has been archived by the owner on Mar 29, 2023. It is now read-only.

Commit

Permalink
Merge pull request #14 from ipfs/fix/content-disposition-header
Browse files Browse the repository at this point in the history
fix the content disposition header
  • Loading branch information
Stebalien authored Mar 20, 2019
2 parents 98673cc + cff97fc commit 883a000
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 883a000

Please sign in to comment.