Skip to content

Commit

Permalink
Always check via http and https whether htaccess is working
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen authored and Backportbot committed Nov 12, 2019
1 parent 21d6507 commit de53c97
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/private/legacy/util.php
Original file line number Diff line number Diff line change
Expand Up @@ -1249,14 +1249,26 @@ public function isHtaccessWorking(\OCP\IConfig $config) {
$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);

/*
* If the content is not equal to test content our .htaccess
* is working as required
*/
return $content !== $testContent;
return $content !== $testContent && $fallbackContent !== $testContent;
}

/**
Expand Down

0 comments on commit de53c97

Please sign in to comment.