From 145db6a2904f62a93be3cb1eb9d027e958d31cb5 Mon Sep 17 00:00:00 2001 From: Shawn Date: Fri, 30 Nov 2018 01:51:31 -0600 Subject: [PATCH] Attempt to fix Facebook's browser file picker --- client/src/containers/Dropzone/view.jsx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/client/src/containers/Dropzone/view.jsx b/client/src/containers/Dropzone/view.jsx index 10bd9aaa..7a4c02bd 100644 --- a/client/src/containers/Dropzone/view.jsx +++ b/client/src/containers/Dropzone/view.jsx @@ -11,11 +11,10 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' import { faEdit } from '@fortawesome/free-solid-svg-icons'; const isFacebook = (() => { - if(typeof window === 'undefined') { + if(typeof window === 'undefined' || typeof window.navigator.userAgent === 'undefined') { return false; } - const ua = window.navigator.userAgent || window.navigator.vendor || window.window.opera; - return ua.indexOf('FBAN') !== -1 || ua.indexOf('FBAV') !== -1; + return window.navigator.userAgent.indexOf('FBAN') !== -1 || window.navigator.userAgent.indexOf('FBAV') !== -1; })(); class Dropzone extends React.Component { @@ -205,7 +204,7 @@ class Dropzone extends React.Component { type='file' id='file_input' name='file_input' - {...(isFacebook ? {} : { accept: 'video/*,image/*' })} + {...(isFacebook ? { accept: 'image/*' } : { accept: 'video/*,image/*' })} onChange={this.handleFileInput} encType='multipart/form-data' />