r61618 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61617‎ | r61618 | r61619 >
Date:00:46, 28 January 2010
Author:catrope
Status:deferred
Tags:
Comment:
UsabilityInitiative: (bug 22295) Link dialog doesn't escape [ in external link targets
Modified paths:
  • /trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js (modified) (history)
  • /trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.hooks.php
@@ -16,14 +16,14 @@
1717 array( 'src' => 'Modules/Preview/Preview.js', 'version' => 6 ),
1818 array( 'src' => 'Modules/Publish/Publish.js', 'version' => 6 ),
1919 array( 'src' => 'Modules/Toc/Toc.js', 'version' => 7 ),
20 - array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 39 ),
 20+ array( 'src' => 'Modules/Toolbar/Toolbar.js', 'version' => 40 ),
2121 array( 'src' => 'Modules/TemplateEditor/TemplateEditor.js', 'version' => 4 ),
2222 ),
2323 'combined' => array(
24 - array( 'src' => 'WikiEditor.combined.js', 'version' => 41 ),
 24+ array( 'src' => 'WikiEditor.combined.js', 'version' => 42 ),
2525 ),
2626 'minified' => array(
27 - array( 'src' => 'WikiEditor.combined.min.js', 'version' => 41 ),
 27+ array( 'src' => 'WikiEditor.combined.min.js', 'version' => 42 ),
2828 ),
2929 );
3030 static $messages = array(
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.js
@@ -1184,13 +1184,16 @@
11851185 buttons: {
11861186 'wikieditor-toolbar-tool-link-insert': function() {
11871187 function escapeInternalText( s ) {
 1188+ // FIXME: Should this escape [[ too? Seems to work without that
11881189 return s.replace( /(]{2,})/g, '<nowiki>$1</nowiki>' );
11891190 }
11901191 function escapeExternalTarget( s ) {
11911192 return s.replace( / /g, '%20' )
 1193+ .replace( /\[/g, '%5B' )
11921194 .replace( /]/g, '%5D' );
11931195 }
11941196 function escapeExternalText( s ) {
 1197+ // FIXME: Should this escape [ too? Seems to work without that
11951198 return s.replace( /(]+)/g, '<nowiki>$1</nowiki>' );
11961199 }
11971200 var insertText = '';
Index: trunk/extensions/UsabilityInitiative/WikiEditor/WikiEditor.combined.min.js
@@ -54,7 +54,7 @@
5555 var cache=$j(this).data('suggcache');if(typeof cache[title]!='undefined'){$j(this).suggestions('suggestions',cache[title]);return;}
5656 var request=$j.ajax({url:wgScriptPath+'/api.php',data:{'action':'opensearch','search':title,'namespace':0,'suggest':'','format':'json'},dataType:'json',success:function(data){cache[title]=data[1];$j(that).suggestions('suggestions',data[1]);}});$j(this).data('request',request);},cancel:function(){var request=$j(this).data('request');if(request)
5757 request.abort();}});},dialog:{width:500,dialogClass:'wikiEditor-toolbar-dialog',buttons:{'wikieditor-toolbar-tool-link-insert':function(){function escapeInternalText(s){return s.replace(/(]{2,})/g,'<nowiki>$1</nowiki>');}
58 -function escapeExternalTarget(s){return s.replace(/ /g,'%20').replace(/]/g,'%5D');}
 58+function escapeExternalTarget(s){return s.replace(/ /g,'%20').replace(/\[/g,'%5B').replace(/]/g,'%5D');}
5959 function escapeExternalText(s){return s.replace(/(]+)/g,'<nowiki>$1</nowiki>');}
6060 var insertText='';var whitespace=$j('#wikieditor-toolbar-link-dialog').data('whitespace');var target=$j('#wikieditor-toolbar-link-int-target').val();var text=$j('#wikieditor-toolbar-link-int-text').val();var u=mw.usability;if(target==''){alert(u.getMsg('wikieditor-toolbar-tool-link-empty'));return;}
6161 if($j.trim(text)==''){text='';}
Index: trunk/extensions/UsabilityInitiative/WikiEditor/Modules/Toolbar/Toolbar.js
@@ -1135,13 +1135,16 @@
11361136 buttons: {
11371137 'wikieditor-toolbar-tool-link-insert': function() {
11381138 function escapeInternalText( s ) {
 1139+ // FIXME: Should this escape [[ too? Seems to work without that
11391140 return s.replace( /(]{2,})/g, '<nowiki>$1</nowiki>' );
11401141 }
11411142 function escapeExternalTarget( s ) {
11421143 return s.replace( / /g, '%20' )
 1144+ .replace( /\[/g, '%5B' )
11431145 .replace( /]/g, '%5D' );
11441146 }
11451147 function escapeExternalText( s ) {
 1148+ // FIXME: Should this escape [ too? Seems to work without that
11461149 return s.replace( /(]+)/g, '<nowiki>$1</nowiki>' );
11471150 }
11481151 var insertText = '';

Status & tagging log