Tags:
create new tag
, view all tags

Relative URIs don't work with Arbitrary Text For Wiki Word Links

ArbitraryTextForWikiWordLinks doesn't support relative URIs (http://www.w3.org/TR/REC-html40/intro/intro.html). This means it is not possible to specify a link to elsewhere on a web server without hardcoding the server address.

Test case

Enter a URI like [[/cgi-bin/testenv.pl][Test]] into a TWiki page, and it will be interpreted as an invalid TWiki link. Modify the URI to be [[http://www.twiki.org/cgi-bin/testenv.pl][Test]] and it will be interpreted as a valid link.

I corrected this by modifying TWiki::specificLink (TWiki::Render::specificLink in newer releases)

    
    $theLink =~ s/^\s*//o;
    $theLink =~ s/\s*$//o;

  if( $theLink =~ /^(http|ftp|gopher|news|file|https)\:/ ) {
        # found external link
to
    
    $theLink =~ s/^\s*//o;
    $theLink =~ s/\s*$//o;

    if( $theLink =~ /^(http|ftp|gopher|news|file|https)\:/ || $theLink =~ /^\/\w+/ ) {
       # found external link

Environment

TWiki version: 01 Dec 2001
TWiki plugins:  
Server OS: Solaris 2.8
Web server: Apache 1.3.12
Perl version: 5.005_3
Client OS: Any
Web Browser: Any

-- ScottDrennan - 13 Jun 2002

Does the recent change to allowing the pub dir to be a direct link rather than a completely new http request fix this too? If not, maybe this should be a PatchProposal instead of a BugReport.

-- MattWilkie - 01 Jun 2004

This sounds more like an enhancement request. The documented way to call scripts is with [[%SCRIPTURLPATH%/testenv%SCRIPTSUFFIX%][Test]] which is more portable then a hardcoded /cgi-bin/testenv.pl. See TWiki.TWikiVariables#VarSCRIPTURLPATH

-- PeterThoeny - 02 Jun 2004

Sure, in most cases, the %SCRIPTURLPATH is going to be the best approach. But in the scenario I described in RelativeURLs where relative URLs are absolutely required, this won't work. It's also not ideal if the TWiki web server also serves other non-TWiki content.

-- AdamSpiers - 13 Apr 2005

I'd also venture that relative links of this type are intuitively tried by users and easing such uses will help acceptability. It might be advisable to find a way to halt users writing relative links that actually point to a twiki script though.

-- MartinCleaver - 13 Apr 2005

Topic revision: r6 - 2005-04-14 - AdamSpiers
 
Twitter Delicious Facebook Digg Google Bookmarks E-mail LinkedIn Reddit StumbleUpon    
  • Download TWiki
TWiki logo Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.