You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axkit-dev@xml.apache.org by ma...@sergeant.org on 2006/08/07 02:44:58 UTC

[SVN] [54] Don't redirect when original uri has / at end (despite )

Revision: 54
Author:   matt
Date:     2006-08-07 00:44:28 +0000 (Mon, 07 Aug 2006)

Log Message:
-----------
Don't redirect when original uri has / at end (despite <Location>)
Skip dot-dirs in gallery

Modified Paths:
--------------
    trunk/plugins/demo/gallery
    trunk/plugins/uri_to_file

Modified: trunk/plugins/demo/gallery
===================================================================
--- trunk/plugins/demo/gallery	2006-08-07 00:31:45 UTC (rev 53)
+++ trunk/plugins/demo/gallery	2006-08-07 00:44:28 UTC (rev 54)
@@ -469,13 +469,15 @@
     my $xc = XML::LibXML::XPathContext->new($dom);
     $xc->registerNs('axdir', 'http://axkit.org/2002/filelist');
     
-    # scrub dirs we don't want...
-    for my $node ($xc->findnodes('//axdir:directory[text() = "." or text() = ".."]')) {
+    # scrub files we don't want (dot-files)
+    for my $node ($xc->findnodes('//axdir:file[starts-with(text(), ".")]')) {
+        print "Found dot-dir\n";
         $node->parentNode->removeChild($node);
     }
     
-    # scrub files we don't want (dot-files)
-    for my $node ($xc->findnodes('//axdir:file[starts-with(text(), ".")]')) {
+    # scrub dot-dirs
+    for my $node ($xc->findnodes('//axdir:directory[starts-with(text(), ".")]')) {
+        print "Found dot-dir\n";
         $node->parentNode->removeChild($node);
     }
     

Modified: trunk/plugins/uri_to_file
===================================================================
--- trunk/plugins/uri_to_file	2006-08-07 00:31:45 UTC (rev 53)
+++ trunk/plugins/uri_to_file	2006-08-07 00:44:28 UTC (rev 54)
@@ -22,8 +22,9 @@
     
     my $path = canonpath(catfile($self->config->docroot, $uri));
     if (-d $path) {
-        if ($uri !~ /\/$/) {
-            # send redirect?
+        if ($original_uri !~ /\/$/) {
+            # send redirect
+            $self->log(LOGINFO, "redirect to $original_uri/$removed");
             $self->client->headers_out->code(302, "Found");
             $self->client->headers_out->header('Location', "$original_uri/$removed");
             $self->client->headers_out->header('Content-Type', 'text/html');