From f2902dbfe23fbe3bfeb87dd50499c3bc0f54fa79 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Tue, 2 Jun 2015 10:26:36 -0300 Subject: [PATCH] Validate avatar uploads --- client/views/avatar/avatarPrompt.coffee | 5 ++++- client/views/avatar/avatarPrompt.html | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/views/avatar/avatarPrompt.coffee b/client/views/avatar/avatarPrompt.coffee index 3420d64a894..4c865c619c6 100644 --- a/client/views/avatar/avatarPrompt.coffee +++ b/client/views/avatar/avatarPrompt.coffee @@ -44,8 +44,11 @@ Template.avatarPrompt.events template.getSuggestions() - 'change .myFileInput': (event, template) -> + 'change .avatar-file-input': (event, template) -> FS.Utility.eachFile event, (blob) -> + file = new FS.File(blob) + if not file? or file.isImage() is false + return reader = new FileReader() reader.readAsDataURL(blob) reader.onloadend = -> diff --git a/client/views/avatar/avatarPrompt.html b/client/views/avatar/avatarPrompt.html index b54e2e735da..7c39b6969e2 100644 --- a/client/views/avatar/avatarPrompt.html +++ b/client/views/avatar/avatarPrompt.html @@ -50,7 +50,7 @@ {{/with}} {{#unless upload}} {{/unless}}