Commit 8203e8f7 authored by Carsten  Rose's avatar Carsten Rose
Browse files

F5578 Safari only handles one filetype in upload dialog. refs #5578 and fixes #5578

parent 14ed99fc
Pipeline #953 passed with stage
in 1 minute and 55 seconds
...@@ -2958,6 +2958,17 @@ abstract class AbstractBuildForm { ...@@ -2958,6 +2958,17 @@ abstract class AbstractBuildForm {
$arr[FE_FILE_MAX_FILE_SIZE] = empty($formElement[FE_FILE_MAX_FILE_SIZE]) ? UPLOAD_DEFAULT_MAX_SIZE : $formElement[FE_FILE_MAX_FILE_SIZE]; $arr[FE_FILE_MAX_FILE_SIZE] = empty($formElement[FE_FILE_MAX_FILE_SIZE]) ? UPLOAD_DEFAULT_MAX_SIZE : $formElement[FE_FILE_MAX_FILE_SIZE];
$arr[FE_FILE_MAX_FILE_SIZE] = Support::returnBytes($arr[FE_FILE_MAX_FILE_SIZE]); $arr[FE_FILE_MAX_FILE_SIZE] = Support::returnBytes($arr[FE_FILE_MAX_FILE_SIZE]);
// Check Safari Bug #5578: in case Safari (Mac OS X or iOS) loads an 'upload element' with more than one filetype, fall back to 'no preselection'.
if (strpos($formElement[FE_FILE_MIME_TYPE_ACCEPT], ',') !== false) {
$ua = $this->store->getVar('HTTP_USER_AGENT', STORE_CLIENT, SANITIZE_ALLOW_ALNUMX);
// Look for " Version/11.0 Mobile/15A5370a Safari/" or " Version/9.0.2 Safari/"
$rc = preg_match(' Version\/.*Safari\/', $ua, $matches);
// But not like " Version/4.0 Chrome/52.0.2743.98 Safari/"
if ($rc == 1 && false === strpos($matches[0], ' Chrome/')) {
$formElement[FE_FILE_MIME_TYPE_ACCEPT] = '';
}
}
if ((Support::returnBytes(ini_get('post_max_size')) < $arr[FE_FILE_MAX_FILE_SIZE]) || if ((Support::returnBytes(ini_get('post_max_size')) < $arr[FE_FILE_MAX_FILE_SIZE]) ||
(Support::returnBytes(ini_get('upload_max_filesize')) < $arr[FE_FILE_MAX_FILE_SIZE]) (Support::returnBytes(ini_get('upload_max_filesize')) < $arr[FE_FILE_MAX_FILE_SIZE])
) { ) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment