--- loncom/lonenc.pm 2006/05/30 12:45:12 1.15 +++ loncom/lonenc.pm 2006/12/08 22:04:57 1.18 @@ -1,7 +1,7 @@ # The LearningOnline Network # URL translation for encrypted filenames # -# $Id: lonenc.pm,v 1.15 2006/05/30 12:45:12 www Exp $ +# $Id: lonenc.pm,v 1.18 2006/12/08 22:04:57 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -32,7 +32,6 @@ use strict; use Apache::lonnet; use Crypt::IDEA; use Time::HiRes qw(gettimeofday); -use lib '/home/httpd/lib/perl/'; use LONCAPA; sub encryptseed { @@ -47,6 +46,8 @@ sub unencrypted { my $uri=shift; $uri=~s/^\/enc\/(\d+)\///; my $cmdlength=$1; + # strip any added extension + $uri=~s/\.[^.]*//; my $seed=&encryptseed(); unless ($seed) { return '/'.$uri; @@ -108,7 +109,12 @@ sub encrypted { sub check_encrypt { my $str=shift; - if ($env{'request.enc'}) { return &Apache::lonenc::encrypted($str); } + if (ref($str)) { + if ($env{'request.enc'}) { $$str = &Apache::lonenc::encrypted($$str); } + return; + } else { + if ($env{'request.enc'}) { return &Apache::lonenc::encrypted($str); } + } return $str; } @@ -130,7 +136,10 @@ sub encrypt_ref { 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; }