Skip to content

Commit

Permalink
Fixes #1684 -- Do not display image preview when file is not accepted
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverroick authored and amplifi committed Aug 3, 2017
1 parent ef0e050 commit f4eac76
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cadasta/core/static/js/image-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ $(function() {
$('.file-remove').text('Remove');

$('.file-input').change(function(event) {
var accepted = $(this).parents('.s3-buckets').attr('data-accepted-types');

var file = event.target.files.length && event.target.files[0];
if (file) {

if (file && (!accepted || accepted.split(',').indexOf(file.type) !== -1)) {
var reader = new FileReader();
reader.onload = function(e) {
$('#avatar-preview').attr('src', e.target.result);
Expand Down

0 comments on commit f4eac76

Please sign in to comment.