--- loncom/interface/londependencies.pm 2013/05/03 21:57:13 1.4 +++ loncom/interface/londependencies.pm 2017/08/13 20:52:59 1.5 @@ -2,7 +2,7 @@ # Handler to manage dependencies for HTML files uploaded directly # to a course. # -# $Id: londependencies.pm,v 1.4 2013/05/03 21:57:13 raeburn Exp $ +# $Id: londependencies.pm,v 1.5 2017/08/13 20:52:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -101,8 +101,12 @@ sub handler { my $docs_url = $env{'form.url'}; my $folderpath = &unescape($env{'form.folderpath'}); my ($mimetype,$numpathchgs,$numrefchanges,%allfiles,%codebase,$url); + my $earlyout; if ($symb) { (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); + unless (&Apache::lonnet::is_on_map($url)) { + $earlyout = 1; + } } elsif (($docs_url) && (($env{'httpref.'.$docs_url} ne '') || ($docs_url =~ m{^\Q/uploaded/$cdom/$cnum/\E(portfolio/syllabus)/}))) { $url = $docs_url; @@ -122,10 +126,18 @@ sub handler { ($destination) = ($url =~ m{^\Quploaded/$cdom/$cnum/\E((?:docs|supplemental)/(?:default|\d+)/\d+)/}); $context = 'coursedoc'; + if ($destination eq '') { + $earlyout = 1; + } } my $js = &Apache::loncommon::ask_embedded_js(); my $output = &Apache::loncommon::start_page($title,$js, {'only_body' => 1}); + if ($earlyout) { + $r->print($output.&mt('Cannot display dependency information - invalid file: [_1].',$url). + &Apache::loncommon::end_page()); + return OK; + } if ($action eq 'modifyhrefs') { my ($result,$count,$codebasecount) = &Apache::loncommon::modify_html_refs('manage_dependencies',$destination,