Skip to content

Commit

Permalink
Merge pull request #17911 from nextcloud/backport/16846/stable15
Browse files Browse the repository at this point in the history
[stable15] Always check via http and https whether htaccess is working
  • Loading branch information
rullzer authored Nov 12, 2019
2 parents 21d6507 + de53c97 commit a76dbe2
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 a76dbe2

Please sign in to comment.