UseModWiki | WikiBugs | RecentChanges | Preferences

Fixed in 1.0.3 --MarkusLude

It is possible to have a free link of the form

[[My Free Link]] or [[My_Free_Link]] for the same page

The later reference is not found on a back links search (clicking the heading on the linked to page)

Possible fix

This seems to fix the problem, adding the missing backlink references. I have not verified any other impact. It works by adding an extra check on pages which do not otherwise contain a match.

The check says

 If freelinks switch is on and the string you are looking for contains spaces
 replace the spaces with underscores
 re-compare the text and pagename 

To apply the fix. Goto the subroutine

sub SearchTitleAndBody {

replace the line

  } elsif ($FreeLinks && ($name =~ m/_/)) {	


 ##    } elsif ($FreeLinks && ($name =~ m/_/)) {					# BH010
    } elsif ($FreeLinks) {								# BH010
    	if ($name =~ m/_/) {								# BH010

and after the lines

 if ($freeName =~ /$string/i) {
        push(@found, $name);


      } elsif ($string =~ m/ /) {						        # BH010
         $freeName = $string;								# BH010
         $freeName =~ s/ /_/g;								# BH010
         if (($Text{'text'} =~ /$freeName/i) || ($name =~ /$freeName/i)) {		# BH010(*)
           push(@found, $name);								# BH010
         }										# BH010
	}										# BH010


The second test in (*) looks unneccessary to me. In the if block ($name =~ m/_/) underscores in page name were replaces with spaces and then compared to the search string. Before (*) spaces in the search string were replaced and then compared to the page name. Seems pretty much the same or am I missing something? --MarkusLude

UseModWiki | WikiBugs | RecentChanges | Preferences
Edit text of this page | View other revisions | Search MetaWiki
Last edited October 4, 2007 8:48 pm by JuanmaMP (diff)