[LON-CAPA-cvs] cvs: loncom / lonenc.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 28 Sep 2006 20:47:14 -0000


albertel		Thu Sep 28 16:47:14 2006 EDT

  Modified files:              
    /loncom	lonenc.pm 
  Log:
  - IE doesn't like extensionless items (BUG#5032)
  
  
Index: loncom/lonenc.pm
diff -u loncom/lonenc.pm:1.16 loncom/lonenc.pm:1.17
--- loncom/lonenc.pm:1.16	Tue May 30 15:47:28 2006
+++ loncom/lonenc.pm	Thu Sep 28 16:47:13 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # URL translation for encrypted filenames
 #
-# $Id: lonenc.pm,v 1.16 2006/05/30 19:47:28 www Exp $
+# $Id: lonenc.pm,v 1.17 2006/09/28 20:47:13 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,6 +46,8 @@
     my $uri=shift;
     $uri=~s/^\/enc\/(\d+)\///;
     my $cmdlength=$1;
+    # strip any added extension
+    $uri=~s/\.[^.]*//;
     my $seed=&encryptseed();
     unless ($seed) {
 	return '/'.$uri;
@@ -129,7 +131,10 @@
 	    if (!$value) { next; }
 	    my $href=&Apache::lonnet::hreflocation($Apache::lonxml::pwd[-1],$value);
 	    if ($href !~ /^http:/) {
+		# IE really wants an extension
+		my ($extension) = ($href =~ m/(\.[^.]*)$/);
 		$href = &Apache::lonenc::encrypted($href,$force_enc);
+		$href .= $extension;
 	    }
 	    $token->[2]->{$name}=$href;
 	}