core: Allow dots in MIME file types

As reported in https://github.com/tus/tusd/issues/304
This commit is contained in:
Marius 2019-09-05 19:45:43 +02:00
parent f1fe5e2603
commit 852b6fa01d
2 changed files with 5 additions and 5 deletions

View File

@ -134,8 +134,8 @@ func TestGet(t *testing.T) {
store.EXPECT().GetInfo("yes").Return(FileInfo{
Offset: 0,
MetaData: map[string]string{
"filetype": "text/html",
"filename": "invoice.html",
"filetype": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"filename": "invoice.docx",
},
}, nil)
@ -148,8 +148,8 @@ func TestGet(t *testing.T) {
URL: "yes",
ResHeader: map[string]string{
"Content-Length": "0",
"Content-Type": "text/html",
"Content-Disposition": `attachment;filename="invoice.html"`,
"Content-Type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"Content-Disposition": `attachment;filename="invoice.docx"`,
},
Code: http.StatusNoContent,
ResBody: "",

View File

@ -24,7 +24,7 @@ var (
reExtractFileID = regexp.MustCompile(`([^/]+)\/?$`)
reForwardedHost = regexp.MustCompile(`host=([^,]+)`)
reForwardedProto = regexp.MustCompile(`proto=(https?)`)
reMimeType = regexp.MustCompile(`^[a-z]+\/[a-z\-\+]+$`)
reMimeType = regexp.MustCompile(`^[a-z]+\/[a-z\-\+\.]+$`)
)
// HTTPError represents an error with an additional status code attached