Tags:
archive_me1Add my vote for this tag create new tag
, view all tags
There's a fairly obscure bug in the March beta and current TWiki.org code that I've just discovered - it's not related to the EasierExternalLinking feature (which is well worth using, take a look :), but it is in the line next to its implementation, so I have now fixed it.

The test case can be seen here on TWiki.org:

[[internal link here]]   and [[http://www.yahoo.com/][Old style external link]]
The result of doing this is:

The fix is to modify the code in TWiki.pm in the March beta to avoid using non-greedy matching in some cases - i.e. change from this:

*** 1183,1188 ****
  # Make internal links
              # '[[Web.odd wiki word#anchor][display text]]' link:
              s/\[\[(.*?)\]\[(.*?)\]\]/&specificLink("",$theWeb,$theTopic,$2,$1)/geo;
              # '[[Web.odd wiki word#anchor]]' link:
              s/\[\[(.*?)\]\]/&specificLink("",$theWeb,$theTopic,$1,$1)/geo;

... into this, using [^\]]+ instead of the non-greedy match to ensure that intervening ]] strings are not gobbled up:

  # Make internal links
              # '[[Web.odd wiki word#anchor][display text]]' link:
              s/\[\[([^\]]+)\]\[([^\]]+)\]\]/&specificLink("",$theWeb,$theTopic,$2,$1)/geo;
              # '[[Web.odd wiki word#anchor]]' link:
              s/\[\[([^\]]+)\]\]/&specificLink("",$theWeb,$theTopic,$1,$1)/geo;

It would be worth reviewing the use of non-greedy (minimal) matching in the TWiki code - although character-class matching, as used here, is harder to read, it is somewhat safer in cases like this.

Another bug cropped up recently due to use of greedy matching, at InterWikiGreedy - the common thread is matching a lot more text than you intended to, so it's worth checking these cases.

-- RichardDonkin - 28 Jul 2001

Thanks for pointin this out. Is fixed now and in TWikiAlphaRelease.

Note: Please set the classification of a new bug to BugReport so that we can track it. The CoreTeam sets it to BugResolved once it is in TWikiAlphaRelease.

-- PeterThoeny - 28 Jul 2001

Topic revision: r3 - 18 Sep 2001 - 23:00:21 - MikeMannix
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback