Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 10ce88b

Browse files
committed
#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
1 parent 2910d8b commit 10ce88b

File tree

1 file changed

+7
-3
lines changed
  • app/code/Magento/ImportExport/view/adminhtml/templates/import/form

1 file changed

+7
-3
lines changed

app/code/Magento/ImportExport/view/adminhtml/templates/import/form/before.phtml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,9 +178,13 @@ require([
178178
.loader('show');
179179
var form = jQuery('#edit_form')
180180
.one('invalid-form.validate', function(e){jQuery('body').loader('hide')});
181-
newActionUrl = (newActionUrl ? newActionUrl : form.attr('action')) +
182-
(form.attr('action').lastIndexOf('?') != -1 ? '&' : '?')+
183-
'form_key=' + encodeURIComponent(form.find('[name="form_key"]').val());
181+
182+
newActionUrl = (newActionUrl ? newActionUrl : form.attr('action'));
183+
if (newActionUrl.lastIndexOf('form_key') === -1) {
184+
newActionUrl = newActionUrl +
185+
(newActionUrl.lastIndexOf('?') !== -1 ? '&' : '?') +
186+
'form_key=' + encodeURIComponent(form.find('[name="form_key"]').val());
187+
}
184188

185189
form.trigger('save', [{
186190
action: newActionUrl,

0 commit comments

Comments
 (0)