core: Allow numbers in mime types
See https://community.transloadit.com/t/tus-server-not-returning-the-correct-content-type-for-video-or-audio-file/15076
This commit is contained in:
parent
6f24143015
commit
a045b8c4fc
|
@ -143,7 +143,7 @@ func TestGet(t *testing.T) {
|
||||||
upload.EXPECT().GetInfo(context.Background()).Return(FileInfo{
|
upload.EXPECT().GetInfo(context.Background()).Return(FileInfo{
|
||||||
Offset: 0,
|
Offset: 0,
|
||||||
MetaData: map[string]string{
|
MetaData: map[string]string{
|
||||||
"filetype": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
"filetype": "application/vnd.openxmlformats-officedocument.wordprocessingml.document.v1",
|
||||||
"filename": "invoice.docx",
|
"filename": "invoice.docx",
|
||||||
},
|
},
|
||||||
}, nil),
|
}, nil),
|
||||||
|
@ -158,7 +158,7 @@ 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": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
"Content-Type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document.v1",
|
||||||
"Content-Disposition": `attachment;filename="invoice.docx"`,
|
"Content-Disposition": `attachment;filename="invoice.docx"`,
|
||||||
},
|
},
|
||||||
Code: http.StatusNoContent,
|
Code: http.StatusNoContent,
|
||||||
|
|
|
@ -23,7 +23,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-z0-9\-\+\.]+$`)
|
||||||
)
|
)
|
||||||
|
|
||||||
// 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