Tags:
create new tag
view all tags
LevienVanZon wrote in Bugs:Item2518:

In order to interface our TWiki with a mailing list archive, I embed the mailing list HTML pages in TWiki topics using the INCLUDE variable. However, the processing of the included pages breaks the links. For example:

The page /list-archive/msg00000.html (the first message in the archive) refers to the next message as msg00001.html. However, after processing by INCLUDE, the link is turned into: /list-archive/msg00000.html/msg00001.html This obviously doesn't work. Using rhe raw parameter is not an option, as the links do need to be processed (otherwise the server would look for the next message in the TWiki /cgi-bin/twiki/bin/view/... directory).

This is reproduced here. The following link is in an included page that contains a link that is relative to the server where the included page resides.

Levien further points out that the documentation states:

When a page is included, normally TWiki will process it, doing the following: 1) Alter relative links to point back to originating host, 2) [...]
This sentence applies to wikiwork links, which are rewritten; but Levien's links are <a href=, and from the documentation he can quite reasonably expect this to work.

I have checked this behaviour in TWiki-3 (Cairo) and it is consistent, so this is not a TWiki-4 problem.

Support rewriting HTML URL references in included pages.

This would obviously impact A, IMG, SCRIPT and any other HTML tag that supports URLs.

-- CrawfordCurrie - 25 Jun 2006

I think this little patch is all that is needed, rest of the url rewriting work is working as it should.

Index: lib/TWiki.pm
===================================================================
--- lib/TWiki.pm        (revision 10702)
+++ lib/TWiki.pm        (working copy)
@@ -1457,6 +1457,9 @@
 sub _rewriteURLInInclude {
     my( $theHost, $theAbsPath, $url ) = @_;

+    # leave out an eventual final non-directory component from the absolute path
+    $theAbsPath =~ s/(.*?)[^\/]*$/$1/;
+
     if( $url =~ /^\// ) {
         # fix absolute URL
         $url = $theHost.$url;

-- SteffenPoulsen - 25 Jun 2006

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2006-06-25 - SteffenPoulsen
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.