--- loncom/lonencurl.pm 2016/02/22 03:36:57 1.6 +++ loncom/lonencurl.pm 2020/03/04 16:33:35 1.7 @@ -2,7 +2,7 @@ # The LearningOnline Network # URL translation for encrypted filenames # -# $Id: lonencurl.pm,v 1.6 2016/02/22 03:36:57 raeburn Exp $ +# $Id: lonencurl.pm,v 1.7 2020/03/04 16:33:35 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -80,8 +80,27 @@ sub handler { if ($redirect eq '') { $redirect=&Apache::lonenc::unencrypted($r->uri); if ($redirect =~ m{^/adm/wrapper/ext/[^\#]+(\#.+)$}) { - $anchor = $1; - $redirect =~ s/\#.+$//; + $anchor = $1; + $redirect =~ s/\#.+$//; + } elsif (($redirect =~ m{^https?://}) && ($r->args)) { + my $symb; + foreach my $item (split(/\&/,$r->args)) { + my ($key,$value) = split(/=/,$item); + if ($key eq 'symb') { + $symb = &Apache::lonenc::unencrypted($value); + last; + } + } + if ($symb) { + my ($map,$id,$res) = &Apache::lonnet::decode_symb($symb); + if (($map =~ /\.page$/) && ($res =~ m{^ext/})) { + if ($res =~ /(\#[^#]+)$/) { + $anchor = $1; + } + $r->headers_out->set(Location => $redirect.$anchor); + return REDIRECT; + } + } } } if ($r->args) { $redirect.='?'.$r->args; }