Skip to content

Commit 2f9ecc7

Browse files
committed
MAGETWO-90177: Image broken on storefront with secure key enabled
Apply changes to tinymce3Adapter.js
1 parent e429f0e commit 2f9ecc7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

app/code/Magento/Tinymce3/view/base/web/tinymce3Adapter.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,9 @@ define([
480480
* @param {String} directive
481481
*/
482482
makeDirectiveUrl: function (directive) {
483-
return this.config['directives_url'].replace(/directive.*/, 'directive/___directive/' + directive);
483+
return this.config['directives_url']
484+
.replace(/directive/, 'directive/___directive/' + directive)
485+
.replace(/\/$/, '');
484486
},
485487

486488
/**
@@ -539,10 +541,10 @@ define([
539541
decodeDirectives: function (content) {
540542
// escape special chars in directives url to use it in regular expression
541543
var url = this.makeDirectiveUrl('%directive%').replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1'),
542-
reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9%,_-]+)\/?'));
544+
reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9,_-]+(?:%2[A-Z]|)+\/?)(?:(?!").)*') + '/?');
543545

544-
return content.gsub(reg, function (match) { //eslint-disable-line no-extra-bind
545-
return Base64.mageDecode(decodeURIComponent(match[1])).replace(/"/g, '"');
546+
return content.gsub(reg, function (match) {
547+
return Base64.mageDecode(decodeURIComponent(match[1]).replace(/\/$/, '')).replace(/"/g, '"');
546548
});
547549
},
548550

0 commit comments

Comments
 (0)