From 733f10cc16127a47d8b9fd4fa0f4e21a4637f85d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 23 Aug 2019 14:33:58 +0200 Subject: [PATCH] Always check via http and https whether htaccess is working Signed-off-by: Joas Schilling --- lib/private/legacy/util.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php index 810f22fb9e5..eed49aff313 100644 --- a/lib/private/legacy/util.php +++ b/lib/private/legacy/util.php @@ -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; } /** -- 2.39.5