Merge pull request #52 from matrix-org/michaelk/allow_json_files
Allow upload of files with a .json postfix.
This commit is contained in:
commit
cc2374e431
3 changed files with 5 additions and 1 deletions
1
changelog.d/52.feature
Normal file
1
changelog.d/52.feature
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Allow upload of Files with a .json postfix.
|
|
@ -119,6 +119,9 @@ func extensionToMimeType(path string) string {
|
||||||
return "image/jpeg"
|
return "image/jpeg"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if strings.HasSuffix(path, ".json") {
|
||||||
|
return "application/json"
|
||||||
|
}
|
||||||
return "application/octet-stream"
|
return "application/octet-stream"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -402,7 +402,7 @@ func formPartToPayload(field, data string, p *parsedPayload) {
|
||||||
// * no silly characters (/, ctrl chars, etc)
|
// * no silly characters (/, ctrl chars, etc)
|
||||||
//
|
//
|
||||||
// * nothing starting with '.'
|
// * 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.
|
// saveFormPart saves a file upload to the report directory.
|
||||||
//
|
//
|
||||||
|
|
Reference in a new issue