core: Allow dots in MIME file types
As reported in https://github.com/tus/tusd/issues/304
This commit is contained in:
parent
f1fe5e2603
commit
852b6fa01d
|
@ -134,8 +134,8 @@ func TestGet(t *testing.T) {
|
||||||
store.EXPECT().GetInfo("yes").Return(FileInfo{
|
store.EXPECT().GetInfo("yes").Return(FileInfo{
|
||||||
Offset: 0,
|
Offset: 0,
|
||||||
MetaData: map[string]string{
|
MetaData: map[string]string{
|
||||||
"filetype": "text/html",
|
"filetype": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||||
"filename": "invoice.html",
|
"filename": "invoice.docx",
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
|
|
||||||
|
@ -148,8 +148,8 @@ func TestGet(t *testing.T) {
|
||||||
URL: "yes",
|
URL: "yes",
|
||||||
ResHeader: map[string]string{
|
ResHeader: map[string]string{
|
||||||
"Content-Length": "0",
|
"Content-Length": "0",
|
||||||
"Content-Type": "text/html",
|
"Content-Type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||||
"Content-Disposition": `attachment;filename="invoice.html"`,
|
"Content-Disposition": `attachment;filename="invoice.docx"`,
|
||||||
},
|
},
|
||||||
Code: http.StatusNoContent,
|
Code: http.StatusNoContent,
|
||||||
ResBody: "",
|
ResBody: "",
|
||||||
|
|
|
@ -24,7 +24,7 @@ var (
|
||||||
reExtractFileID = regexp.MustCompile(`([^/]+)\/?$`)
|
reExtractFileID = regexp.MustCompile(`([^/]+)\/?$`)
|
||||||
reForwardedHost = regexp.MustCompile(`host=([^,]+)`)
|
reForwardedHost = regexp.MustCompile(`host=([^,]+)`)
|
||||||
reForwardedProto = regexp.MustCompile(`proto=(https?)`)
|
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
|
// HTTPError represents an error with an additional status code attached
|
||||||
|
|
Loading…
Reference in New Issue