summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2018-09-28 22:32:19 +0200
committerDaniel Kesselberg <mail@danielkesselberg.de>2018-09-28 22:32:19 +0200
commitc275beecebb96a914616e39ec61a22e4597358ec (patch)
treec6c850aa4a5d2a72bc48ea35a57eec9d0abce5ac
parentb7bd6bd68250612d975b63fcfbb0865224c93d7c (diff)
downloadnextcloud-server-c275beecebb96a914616e39ec61a22e4597358ec.tar.gz
nextcloud-server-c275beecebb96a914616e39ec61a22e4597358ec.zip
Allow url without / for overwrite.cli.url
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
-rw-r--r--lib/private/Setup.php5
-rw-r--r--tests/lib/SetupTest.php11
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index d5ccde6bba3..9f5403b8318 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -445,11 +445,10 @@ class Setup {
if ($webRoot === '') {
throw new InvalidArgumentException('overwrite.cli.url is empty');
}
- $webRoot = parse_url($webRoot, PHP_URL_PATH);
- if ($webRoot === null) {
+ if (!filter_var($webRoot, FILTER_VALIDATE_URL)) {
throw new InvalidArgumentException('invalid value for overwrite.cli.url');
}
- $webRoot = rtrim($webRoot, '/');
+ $webRoot = rtrim(parse_url($webRoot, PHP_URL_PATH), '/');
} else {
$webRoot = !empty(\OC::$WEBROOT) ? \OC::$WEBROOT : '/';
}
diff --git a/tests/lib/SetupTest.php b/tests/lib/SetupTest.php
index 628f9393c15..68ef0b2913e 100644
--- a/tests/lib/SetupTest.php
+++ b/tests/lib/SetupTest.php
@@ -153,14 +153,21 @@ class SetupTest extends \Test\TestCase {
}
\OC::$CLI = $cliState;
- $this->assertEquals($webRoot, $expected);
+ $this->assertSame($webRoot, $expected);
}
public function findWebRootProvider(): array {
return [
'https://www.example.com/nextcloud' => ['https://www.example.com/nextcloud', '/nextcloud'],
'https://www.example.com/' => ['https://www.example.com/', ''],
- 'https://www.example.com' => ['https://www.example.com', false],
+ 'https://www.example.com' => ['https://www.example.com', ''],
+ 'https://nctest13pgsql.lan/nextcloud' => ['https://nctest13pgsql.lan/', ''],
+ 'https://nctest13pgsql.lan/' => ['https://nctest13pgsql.lan/', ''],
+ 'https://nctest13pgsql.lan' => ['https://nctest13pgsql.lan', ''],
+ 'https://192.168.10.10/nc' => ['https://192.168.10.10/nc', '/nc'],
+ 'https://192.168.10.10/' => ['https://192.168.10.10/', ''],
+ 'https://192.168.10.10' => ['https://192.168.10.10', ''],
+ 'invalid' => ['invalid', false],
'empty' => ['', false],
];
}