From 37e4242fdf5c344879009bd157a85f6423a1c475 Mon Sep 17 00:00:00 2001 From: Thorsten Claus Date: Mon, 8 Feb 2021 19:29:04 +0100 Subject: [PATCH] File selection dialog accepts only image types --- app/assets/javascripts/helpers/post_photo_uploader.es6 | 1 + app/assets/javascripts/helpers/profile_photo_uploader.es6 | 1 + app/assets/javascripts/mobile/mobile_profile_photo_uploader.js | 1 + 3 files changed, 3 insertions(+) diff --git a/app/assets/javascripts/helpers/post_photo_uploader.es6 b/app/assets/javascripts/helpers/post_photo_uploader.es6 index 10a6f6b24..581a41f31 100644 --- a/app/assets/javascripts/helpers/post_photo_uploader.es6 +++ b/app/assets/javascripts/helpers/post_photo_uploader.es6 @@ -54,6 +54,7 @@ Diaspora.PostPhotoUploader = class { } }, validation: { + acceptFiles: "image/png, image/jpeg, image/gif", allowedExtensions: ["jpg", "jpeg", "png", "gif"], sizeLimit: (window.Promise && qq.supportedFeatures.scaling ? null : this.sizeLimit) }, diff --git a/app/assets/javascripts/helpers/profile_photo_uploader.es6 b/app/assets/javascripts/helpers/profile_photo_uploader.es6 index 5524adf2b..6dc3c205b 100644 --- a/app/assets/javascripts/helpers/profile_photo_uploader.es6 +++ b/app/assets/javascripts/helpers/profile_photo_uploader.es6 @@ -38,6 +38,7 @@ Diaspora.ProfilePhotoUploader = class { this.fineUploader = new qq.FineUploaderBasic({ element: this.fileInput, validation: { + acceptFiles: "image/png, image/jpeg", allowedExtensions: ["jpg", "jpeg", "png"] }, request: { diff --git a/app/assets/javascripts/mobile/mobile_profile_photo_uploader.js b/app/assets/javascripts/mobile/mobile_profile_photo_uploader.js index 059622cea..cc70ba1c1 100644 --- a/app/assets/javascripts/mobile/mobile_profile_photo_uploader.js +++ b/app/assets/javascripts/mobile/mobile_profile_photo_uploader.js @@ -11,6 +11,7 @@ Diaspora.ProfilePhotoUploader.prototype = { new qq.FineUploaderBasic({ element: document.getElementById("file-upload"), validation: { + acceptFiles: "image/png, image/jpeg, image/gif", allowedExtensions: ["jpg", "jpeg", "png"], sizeLimit: 4194304 },