[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm

raeburn raeburn at source.lon-capa.org
Thu Apr 18 12:42:58 EDT 2024


raeburn		Thu Apr 18 16:42:58 2024 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
  Log:
  - Remove Document Root from $env{'request.filename'} before passing file's  
    full path in Authoring Space to lonnet::can_edit_resource() for editability
    check.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.546 loncom/interface/lonmenu.pm:1.547
--- loncom/interface/lonmenu.pm:1.546	Mon Jan  1 01:22:24 2024
+++ loncom/interface/lonmenu.pm	Thu Apr 18 16:42:58 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.546 2024/01/01 01:22:24 raeburn Exp $
+# $Id: lonmenu.pm,v 1.547 2024/04/18 16:42:58 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1710,7 +1710,14 @@
         } elsif (($resurl !~ m{^/?adm/($match_domain)/($match_username)/aboutme$}) &&
                  ($resurl ne '/cgi-bin/printout.pl')) {
             if ($env{'request.filename'}) {
-                my $file=&Apache::lonnet::declutter($env{'request.filename'});
+                my $file;
+                my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
+                if ($env{'request.filename'} =~ m{^\Q$londocroot\E/priv/}) {
+                    $file = $env{'request.filename'};
+                    $file =~ s{^\Q$londocroot\E/}{};
+                } else {
+                    $file=&Apache::lonnet::declutter($env{'request.filename'});
+                }
                 ($cfile,$home,$switchserver,$forceedit,$forceview) =
                     &Apache::lonnet::can_edit_resource($file,$cnum,$cdom,
                         &Apache::lonnet::clutter($resurl),$env{'request.symb'},$group);




More information about the LON-CAPA-cvs mailing list