File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -579,7 +579,7 @@ public static function updateHtaccess(): bool {
579579 return false ;
580580 }
581581
582- // We're a static method; cannot use DI $this->config
582+ // We're a static method; cannot use $this->config
583583 $ config = Server::get (SystemConfig::class);
584584
585585 try {
@@ -588,6 +588,10 @@ public static function updateHtaccess(): bool {
588588 return false ;
589589 }
590590
591+ // TODO: Add a check to detect when the .htaccess file isn't the expected one
592+ // (e.g. when it's the datadirectory one due to a misconfiguration) so that we
593+ // don't append to the wrong file (and enable a very problematic configuration).
594+
591595 // Read original content
592596 $ original = @file_get_contents ($ htaccessPath );
593597 // extra check for good measure
@@ -698,6 +702,8 @@ public static function protectDataDirectory(): void {
698702 // Content for the .htaccess file that locks down (most) Apache environments
699703 $ now = date ('Y-m-d H:i:s ' );
700704 $ content = "# Generated by Nextcloud on $ now \n" ;
705+ $ content .= "# Deployed in Nextcloud data directory \n" ;
706+ $ content .= "# Do not change this file \n\n" ;
701707 $ content .= "# Section for Apache 2.4 to 2.6 \n" ;
702708 $ content .= "<IfModule mod_authz_core.c> \n" ;
703709 $ content .= " Require all denied \n" ;
You can’t perform that action at this time.
0 commit comments