Added server side validation of jpegs as images

Этот коммит содержится в:
nickago
2015-08-11 12:19:23 -07:00
родитель a60d774634
Коммит fe0b055981
2 изменённых файлов: 2 добавлений и 8 удалений

Просмотреть файл

@@ -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 {

Просмотреть файл

@@ -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;