mirror of
https://github.com/nextcloud/server.git
synced 2026-06-08 16:26:59 -04:00
Merge pull request #58817 from nextcloud/fix/noid/add-fallback-to-raw-path-info
This commit is contained in:
commit
27c438503b
2 changed files with 63 additions and 1 deletions
|
|
@ -717,7 +717,7 @@ class Request implements \ArrayAccess, \Countable, IRequest {
|
|||
$requestUri = substr($requestUri, 0, $pos);
|
||||
}
|
||||
|
||||
$scriptName = $this->server['SCRIPT_NAME'];
|
||||
$scriptName = $this->server['SCRIPT_NAME'] ?? '';
|
||||
$pathInfo = $requestUri;
|
||||
|
||||
// strip off the script name's dir and file name
|
||||
|
|
|
|||
|
|
@ -1614,6 +1614,68 @@ class RequestTest extends \Test\TestCase {
|
|||
];
|
||||
}
|
||||
|
||||
public function testGetRawPathInfoWithoutScriptName(): void {
|
||||
$request = new Request(
|
||||
[
|
||||
'server' => [
|
||||
'REQUEST_URI' => '/index.php/apps/files/',
|
||||
]
|
||||
],
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
);
|
||||
|
||||
$this->assertSame('index.php/apps/files/', $request->getRawPathInfo());
|
||||
}
|
||||
|
||||
public function testGetPathInfoWithoutScriptName(): void {
|
||||
$request = new Request(
|
||||
[
|
||||
'server' => [
|
||||
'REQUEST_URI' => '/index.php/apps/files/',
|
||||
]
|
||||
],
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
);
|
||||
|
||||
$this->assertSame('index.php/apps/files/', $request->getPathInfo());
|
||||
}
|
||||
|
||||
public function testGetRawPathInfoWithoutScriptNameRoot(): void {
|
||||
$request = new Request(
|
||||
[
|
||||
'server' => [
|
||||
'REQUEST_URI' => '/',
|
||||
]
|
||||
],
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
);
|
||||
|
||||
$this->assertSame('', $request->getRawPathInfo());
|
||||
}
|
||||
|
||||
public function testGetRawPathInfoWithoutScriptNameOrRequestUri(): void {
|
||||
$request = new Request(
|
||||
[
|
||||
'server' => []
|
||||
],
|
||||
$this->requestId,
|
||||
$this->config,
|
||||
$this->csrfTokenManager,
|
||||
$this->stream
|
||||
);
|
||||
|
||||
$this->assertSame('', $request->getRawPathInfo());
|
||||
}
|
||||
|
||||
public function testGetRequestUriWithoutOverwrite(): void {
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
|
|
|
|||
Loading…
Reference in a new issue