From 6d5ee6380cd9038fc1ef3403031e550f44440524 Mon Sep 17 00:00:00 2001 From: NazarKlovanych Date: Thu, 27 Dec 2018 11:31:38 +0200 Subject: [PATCH 1/6] Fix for issue 19983 --- .../Magento/Ui/view/base/web/js/form/element/file-uploader.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js index 357571350a268..c6bf36f5cc867 100644 --- a/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js +++ b/app/code/Magento/Ui/view/base/web/js/form/element/file-uploader.js @@ -16,7 +16,8 @@ define([ 'Magento_Ui/js/form/element/abstract', 'mage/backend/notification', 'mage/translate', - 'jquery/file-uploader' + 'jquery/file-uploader', + 'mage/adminhtml/tools' ], function ($, _, utils, uiAlert, validator, Element, notification, $t) { 'use strict'; From 188a3e66e7d9604942d7c36cfaec7dc5bae32710 Mon Sep 17 00:00:00 2001 From: NazarKlovanych Date: Thu, 27 Dec 2018 12:53:39 +0200 Subject: [PATCH 2/6] Fix save customer attribute image --- app/code/Magento/Eav/Model/Attribute/Data/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Attribute/Data/File.php b/app/code/Magento/Eav/Model/Attribute/Data/File.php index 1b2cac32598e1..b8ca34986111b 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/File.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/File.php @@ -146,7 +146,7 @@ protected function _validateByRules($value) return $this->_fileValidator->getMessages(); } - if (!empty($value['tmp_name']) && !is_uploaded_file($value['tmp_name'])) { + if (empty($value['tmp_name']) && !is_uploaded_file($value['tmp_name'])) { return [__('"%1" is not a valid file.', $label)]; } From 20fd58914382220cb4b5050d0540ec8f62c63814 Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Fri, 18 Jan 2019 00:00:55 +0200 Subject: [PATCH 3/6] add mage/adminhtml/tools for Base64 --- app/code/Magento/Variable/view/adminhtml/web/variables.js | 3 ++- .../wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Variable/view/adminhtml/web/variables.js b/app/code/Magento/Variable/view/adminhtml/web/variables.js index 47f027f27102d..bf8bfbc570ce2 100644 --- a/app/code/Magento/Variable/view/adminhtml/web/variables.js +++ b/app/code/Magento/Variable/view/adminhtml/web/variables.js @@ -16,7 +16,8 @@ define([ 'Magento_Variable/js/custom-directive-generator', 'Magento_Ui/js/lib/spinner', 'jquery/ui', - 'prototype' + 'prototype', + 'mage/adminhtml/tools' ], function (jQuery, notification, $t, wysiwyg, registry, mageApply, utils, configGenerator, customGenerator, loader) { 'use strict'; diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js index e6f12a2e51acf..96091e4099676 100644 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js @@ -9,7 +9,8 @@ define([ 'Magento_Variable/js/config-directive-generator', 'Magento_Variable/js/custom-directive-generator', 'wysiwygAdapter', - 'jquery' + 'jquery', + 'mage/adminhtml/tools' ], function (configDirectiveGenerator, customDirectiveGenerator, wysiwyg, jQuery) { return function (config) { tinymce.create('tinymce.plugins.magentovariable', { From 9ca8077242bd6bb7a09c8bb77f4495b39787fcb0 Mon Sep 17 00:00:00 2001 From: Sergii Ivashchenko Date: Fri, 18 Jan 2019 14:07:02 +0200 Subject: [PATCH 4/6] Update app/code/Magento/Eav/Model/Attribute/Data/File.php Co-Authored-By: Nazar65 --- app/code/Magento/Eav/Model/Attribute/Data/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Attribute/Data/File.php b/app/code/Magento/Eav/Model/Attribute/Data/File.php index b8ca34986111b..8a29c1f2326cf 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/File.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/File.php @@ -146,7 +146,7 @@ protected function _validateByRules($value) return $this->_fileValidator->getMessages(); } - if (empty($value['tmp_name']) && !is_uploaded_file($value['tmp_name'])) { + if (empty($value['tmp_name']) || !is_uploaded_file($value['tmp_name'])) { return [__('"%1" is not a valid file.', $label)]; } From a0516563c682a9d3b51ffd0f0aa7040591dedf0a Mon Sep 17 00:00:00 2001 From: Nazar Klovanych Date: Sat, 26 Jan 2019 21:44:12 +0200 Subject: [PATCH 5/6] Update File.php to resolve issue 19983 --- app/code/Magento/Eav/Model/Attribute/Data/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Attribute/Data/File.php b/app/code/Magento/Eav/Model/Attribute/Data/File.php index 8a29c1f2326cf..32283d38a065f 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/File.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/File.php @@ -146,7 +146,7 @@ protected function _validateByRules($value) return $this->_fileValidator->getMessages(); } - if (empty($value['tmp_name']) || !is_uploaded_file($value['tmp_name'])) { + if (!empty($value['tmp_name']) || !file_exists($value['tmp_name'])) { return [__('"%1" is not a valid file.', $label)]; } From 13722031d11aeb6ce92f0272db06714bce7840e0 Mon Sep 17 00:00:00 2001 From: Nazar Date: Sat, 26 Jan 2019 21:45:56 +0200 Subject: [PATCH 6/6] Update File.php --- app/code/Magento/Eav/Model/Attribute/Data/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Attribute/Data/File.php b/app/code/Magento/Eav/Model/Attribute/Data/File.php index 32283d38a065f..a52c88261166e 100644 --- a/app/code/Magento/Eav/Model/Attribute/Data/File.php +++ b/app/code/Magento/Eav/Model/Attribute/Data/File.php @@ -146,7 +146,7 @@ protected function _validateByRules($value) return $this->_fileValidator->getMessages(); } - if (!empty($value['tmp_name']) || !file_exists($value['tmp_name'])) { + if (!empty($value['tmp_name']) && !file_exists($value['tmp_name'])) { return [__('"%1" is not a valid file.', $label)]; }