Merge pull request #17910 from nextcloud/backport/16846/stable16

[stable16] Always check via http and https whether htaccess is working
This commit is contained in:
Roeland Jago Douma 2019-11-12 19:51:00 +01:00 committed by GitHub
commit 21968d0595
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -1249,6 +1249,18 @@ class OC_Util {
$content = false;
}
if (strpos($url, 'https:') === 0) {
$url = 'http:' . substr($url, 6);
} else {
$url = 'https:' . substr($url, 5);
}
try {
$fallbackContent = \OC::$server->getHTTPClientService()->newClient()->get($url)->getBody();
} catch (\Exception $e) {
$fallbackContent = false;
}
// cleanup
@unlink($testFile);
@ -1256,7 +1268,7 @@ class OC_Util {
* If the content is not equal to test content our .htaccess
* is working as required
*/
return $content !== $testContent;
return $content !== $testContent && $fallbackContent !== $testContent;
}
/**