mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
fix: omit : and @ if user and pass are empty
So, unparsing should not end up with https://:@appwrite.io just because user and pass are empty strings.
This commit is contained in:
@@ -68,9 +68,9 @@ class URL
|
||||
|
||||
$parts['user'] = isset($url['user']) ? $url['user'] : '';
|
||||
|
||||
$parts['pass'] = isset($url['pass']) ? ':' . $url['pass'] : '';
|
||||
$parts['pass'] = !empty($url['pass']) ? ':' . $url['pass'] : '';
|
||||
|
||||
$parts['pass'] = ($parts['user'] || $parts['pass']) ? $parts['pass'] . '@' : '';
|
||||
$parts['pass'] = ($parts['user'] || !empty($parts['pass'])) ? $parts['pass'] . '@' : '';
|
||||
|
||||
$parts['path'] = isset($url['path']) ? $url['path'] : '';
|
||||
|
||||
|
||||
@@ -95,6 +95,19 @@ class URLTest extends TestCase
|
||||
|
||||
$this->assertIsString($url);
|
||||
$this->assertEquals('https://eldad:fux@appwrite.io/#bottom', $url);
|
||||
|
||||
$url = URL::unparse([
|
||||
'scheme' => 'https',
|
||||
'user' => '',
|
||||
'pass' => '',
|
||||
'host' => 'appwrite.io',
|
||||
'port' => null,
|
||||
'path' => '',
|
||||
'fragment' => '',
|
||||
]);
|
||||
|
||||
$this->assertIsString($url);
|
||||
$this->assertEquals('https://appwrite.io/#', $url);
|
||||
}
|
||||
|
||||
public function testParseQuery(): void
|
||||
|
||||
Reference in New Issue
Block a user