Skip to content

Commit

Permalink
Merge pull request #52 from matrix-org/michaelk/allow_json_files
Browse files Browse the repository at this point in the history
Allow upload of files with a .json postfix.
  • Loading branch information
michaelkaye committed Feb 8, 2022
2 parents 589e925 + a7724b7 commit cc2374e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/52.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Allow upload of Files with a .json postfix.
3 changes: 3 additions & 0 deletions logserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ func extensionToMimeType(path string) string {
return "image/jpeg"
}

if strings.HasSuffix(path, ".json") {
return "application/json"
}
return "application/octet-stream"
}

Expand Down
2 changes: 1 addition & 1 deletion submit.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ func formPartToPayload(field, data string, p *parsedPayload) {
// * no silly characters (/, ctrl chars, etc)
//
// * nothing starting with '.'
var filenameRegexp = regexp.MustCompile(`^[a-zA-Z0-9_-]+\.(jpg|png|txt)$`)
var filenameRegexp = regexp.MustCompile(`^[a-zA-Z0-9_-]+\.(jpg|png|txt|json)$`)

// saveFormPart saves a file upload to the report directory.
//
Expand Down

0 comments on commit cc2374e

Please sign in to comment.