[Home]WikiBugs/AmpersandBug

UseModWiki | WikiBugs | RecentChanges | Preferences

Fixed in 1.0.1 --MarkusLude

Ampersand Bug

Description

Script links generated by UseMod contain unencoded ampersands in URLs. This results in nonexistent character entities (such as action=edit&id=.. -- yet there is no &id HTML entity). Most user agents regard such & characters as & but this is still an error, and one that is easily fixed, thanks to the fine factoring of UseMod's code.

A more complete solution to URI generation problems is at WikiPatches/ProperUriEscaping

Fix

--- wiki.pl     2003-09-11 14:21:02.000000000 +0200
+++ AmpersandBug.pl     2005-10-03 17:47:04.000000000 +0200
@@ -1092,13 +1092,15 @@

 sub ScriptLink {
   my ($action, $text) = @_;

+  $action =~ s/&/&/g;
   return "<a href=\"$ScriptName" . &ScriptLinkChar() . "$action\">$text</a>";
 }

 sub ScriptLinkClass {
   my ($action, $text, $class) = @_;

+  $action =~ s/&/&amp;/g;
   return "<a href=\"$ScriptName" . &ScriptLinkChar() . "$action\""
          . ' class=' . $class . ">$text</a>";
 }
@@ -1242,6 +1244,7 @@
 sub ScriptLinkTitle {
   my ($action, $text, $title) = @_;

+  $action =~ s/&/&amp;/g;
   if ($FreeLinks) {
     $action =~ s/ /_/g;
   }

-- UngarPeter


UseModWiki | WikiBugs | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited August 30, 2007 6:47 pm by MarkusLude (diff)
Search: