summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-08-11 12:19:23 -0700
committernickago <ngonella@calpoly.edu>2015-08-11 12:19:23 -0700
commitfe0b0559818b3d70c97c9081ec633927550892a8 (patch)
tree46cd28489af7f51b0d1023f2a1cf52f2baf411a0
parenta60d774634ba3c9d0e3681ec432af169be379eba (diff)
downloadchat-fe0b0559818b3d70c97c9081ec633927550892a8.tar.gz
chat-fe0b0559818b3d70c97c9081ec633927550892a8.tar.bz2
chat-fe0b0559818b3d70c97c9081ec633927550892a8.zip
Added server side validation of jpegs as images
-rw-r--r--model/file.go4
-rw-r--r--web/react/components/file_upload.jsx6
2 files changed, 2 insertions, 8 deletions
diff --git a/model/file.go b/model/file.go
index 3d38ddbd1..6055cbc9a 100644
--- a/model/file.go
+++ b/model/file.go
@@ -13,8 +13,8 @@ const (
)
var (
- IMAGE_EXTENSIONS = [4]string{".jpg", ".gif", ".bmp", ".png"}
- IMAGE_MIME_TYPES = map[string]string{".jpg": "image/jpeg", ".gif": "image/gif", ".bmp": "image/bmp", ".png": "image/png", ".tiff": "image/tiff"}
+ IMAGE_EXTENSIONS = [5]string{".jpg", ".jpeg", ".gif", ".bmp", ".png"}
+ IMAGE_MIME_TYPES = map[string]string{".jpg": "image/jpeg", ".jepg": "image/jpeg", ".gif": "image/gif", ".bmp": "image/bmp", ".png": "image/png", ".tiff": "image/tiff"}
)
type FileUploadResponse struct {
diff --git a/web/react/components/file_upload.jsx b/web/react/components/file_upload.jsx
index b90fa4fd3..0638e7109 100644
--- a/web/react/components/file_upload.jsx
+++ b/web/react/components/file_upload.jsx
@@ -101,9 +101,6 @@ module.exports = React.createClass({
for (var i = 0; i < items.length; i++) {
if (items[i].type.indexOf('image') !== -1) {
var ext = items[i].type.split('/')[1].toLowerCase();
- if (ext === 'jpeg') {
- ext = 'jpg';
- }
if (Constants.IMAGE_TYPES.indexOf(ext) < 0) {
continue;
@@ -124,9 +121,6 @@ module.exports = React.createClass({
var file = items[i].getAsFile();
var ext = items[i].type.split('/')[1].toLowerCase();
- if (ext === 'jpeg') {
- ext = 'jpg';
- }
if (Constants.IMAGE_TYPES.indexOf(ext) < 0) {
continue;