From: Alexander Ebert Date: Tue, 31 Mar 2015 11:36:57 +0000 (+0200) Subject: Fixed some regex being too greedy X-Git-Tag: 2.1.3~43^2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=05d8e4b162e582786d7bf7e3f7260de3d74d082d;p=GitHub%2FWoltLab%2FWCF.git Fixed some regex being too greedy --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 039e3f9514..46204aea26 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -290,7 +290,7 @@ RedactorPlugins.wbbcode = function() { // preserve code listings var $cachedCodeListings = { }; - html = html.replace(/\n*
[\s\S]+?
    ([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g, function(match, codeBoxAttributes1, codeBoxAttributes2, lineNumber, codeContent) { + html = html.replace(/]+?)class="codeBox[^"]+"([^>]*?)>\n*
    [\s\S]+?
      ([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g, function(match, codeBoxAttributes1, codeBoxAttributes2, lineNumber, codeContent) { var $attributes = codeBoxAttributes1 + ' ' + codeBoxAttributes2; var $highlighter = ''; var $filename = ''; @@ -616,7 +616,7 @@ RedactorPlugins.wbbcode = function() { html = html.replace(/ ?]*?class="smiley"[^>]*?alt="([^"]+?)"[^>]*?> ?/gi, ' $1 '); // chrome, ie // attachments - html = html.replace(//gi, function(match, attributesBefore, attributesAfter) { + html = html.replace(/]*?)class="[^"]*redactorEmbeddedAttachment[^"]*"([^>]*?)>/gi, function(match, attributesBefore, attributesAfter) { var $attributes = attributesBefore + ' ' + attributesAfter; var $attachmentID; if ($attributes.match(/data-attachment-id="(\d+)"/)) { @@ -654,7 +654,7 @@ RedactorPlugins.wbbcode = function() { }); // [img] - html = html.replace(/]*?src=(["'])([^"']+?)\1.*?style="([^"]+)".*?>/gi, function(match, quotationMarks, source, style) { + html = html.replace(/]*?src=(["'])([^"']+?)\1[^>]*?style="([^"]+)"[^>]*?>/gi, function(match, quotationMarks, source, style) { var $float = 'none'; var $width = 0; @@ -679,7 +679,7 @@ RedactorPlugins.wbbcode = function() { return "[img]" + source + "[/img]"; }); - html = html.replace(/]*?src=(["'])([^"']+?)\1.*?>/gi, '[img]$2[/img]'); + html = html.replace(/]*?src=(["'])([^"']+?)\1[^>]*?>/gi, '[img]$2[/img]'); // [*] html = html.replace(/
    1. /gi, '[*]');