From 10ce88bf15c8169ed263831e9b7c144064a42bd4 Mon Sep 17 00:00:00 2001 From: David Manners Date: Sat, 16 Jun 2018 13:58:37 +0000 Subject: [PATCH] magento-engcom/import-export-improvements#58: Fix generation of import url - update the building of import url in before.phtml - check that we do not already have the form_key in our url, - build the newActionUrl first so that we always are using the same url to build the url --- .../view/adminhtml/templates/import/form/before.phtml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/before.phtml b/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/before.phtml index 73b013fdb8df4..8a52f4ca88e75 100644 --- a/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/before.phtml +++ b/app/code/Magento/ImportExport/view/adminhtml/templates/import/form/before.phtml @@ -178,9 +178,13 @@ require([ .loader('show'); var form = jQuery('#edit_form') .one('invalid-form.validate', function(e){jQuery('body').loader('hide')}); - newActionUrl = (newActionUrl ? newActionUrl : form.attr('action')) + - (form.attr('action').lastIndexOf('?') != -1 ? '&' : '?')+ - 'form_key=' + encodeURIComponent(form.find('[name="form_key"]').val()); + + newActionUrl = (newActionUrl ? newActionUrl : form.attr('action')); + if (newActionUrl.lastIndexOf('form_key') === -1) { + newActionUrl = newActionUrl + + (newActionUrl.lastIndexOf('?') !== -1 ? '&' : '?') + + 'form_key=' + encodeURIComponent(form.find('[name="form_key"]').val()); + } form.trigger('save', [{ action: newActionUrl,