Skip to content

Commit

Permalink
swarm/api: Can't use ioutil.TempFile - it returns predictable extensi…
Browse files Browse the repository at this point in the history
…on only since go1.11, a bit of copy-paste (ethersphere#527, ethersphere#944)

- added text/markdown content type
  • Loading branch information
nizsheanez committed Sep 24, 2018
1 parent 8dc449a commit d3e2886
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions swarm/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,8 @@ var builtinTypesLower = map[string]string{
".asf": "video/x-ms-asf",
".wmv": "video/x-ms-wmv",
".avi": "video/x-msvideo",

".md": "text/markdown; charset=utf-8",
}

func init() {
Expand Down
2 changes: 1 addition & 1 deletion swarm/api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ func testDetectContentType(t *testing.T, fileName, content, expectedContentType
}
}

// tempFile copy of ioutil.TempFile - because before go1.11 it adding random suffix
// tempFile copy of ioutil.TempFile - because before go1.11 it changes file extension
func tempFile(fileName string) (f *os.File, err error) {
nconflict := 0
for i := 0; i < 10000; i++ {
Expand Down

0 comments on commit d3e2886

Please sign in to comment.