Skip to content

Commit 852b6fa

Browse files
committed
core: Allow dots in MIME file types
As reported in #304
1 parent f1fe5e2 commit 852b6fa

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

get_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ func TestGet(t *testing.T) {
134134
store.EXPECT().GetInfo("yes").Return(FileInfo{
135135
Offset: 0,
136136
MetaData: map[string]string{
137-
"filetype": "text/html",
138-
"filename": "invoice.html",
137+
"filetype": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
138+
"filename": "invoice.docx",
139139
},
140140
}, nil)
141141

@@ -148,8 +148,8 @@ func TestGet(t *testing.T) {
148148
URL: "yes",
149149
ResHeader: map[string]string{
150150
"Content-Length": "0",
151-
"Content-Type": "text/html",
152-
"Content-Disposition": `attachment;filename="invoice.html"`,
151+
"Content-Type": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
152+
"Content-Disposition": `attachment;filename="invoice.docx"`,
153153
},
154154
Code: http.StatusNoContent,
155155
ResBody: "",

unrouted_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ var (
2424
reExtractFileID = regexp.MustCompile(`([^/]+)\/?$`)
2525
reForwardedHost = regexp.MustCompile(`host=([^,]+)`)
2626
reForwardedProto = regexp.MustCompile(`proto=(https?)`)
27-
reMimeType = regexp.MustCompile(`^[a-z]+\/[a-z\-\+]+$`)
27+
reMimeType = regexp.MustCompile(`^[a-z]+\/[a-z\-\+\.]+$`)
2828
)
2929

3030
// HTTPError represents an error with an additional status code attached

0 commit comments

Comments
 (0)