mirror of
https://github.com/nextcloud/server.git
synced 2026-04-21 06:08:46 -04:00
fix(sftp): Handle empty port parameter to allow host-defined ports
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
This commit is contained in:
parent
752b14b772
commit
49aecab074
1 changed files with 5 additions and 2 deletions
|
|
@ -68,9 +68,12 @@ class SFTP extends Common {
|
|||
Stream::register();
|
||||
|
||||
$parsedHost = $this->splitHost($parameters['host']);
|
||||
|
||||
$this->host = $parsedHost[0];
|
||||
$this->port = $parameters['port'] ?? $parsedHost[1];
|
||||
|
||||
// Handle empty port parameter to allow host-defined ports
|
||||
// and ensure strictly numeric ports
|
||||
$parsedPort = $parameters['port'] ?? null;
|
||||
$this->port = (int)(is_numeric($parsedPort) ? $parsedPort : $parsedHost[1]);
|
||||
|
||||
if (!isset($parameters['user'])) {
|
||||
throw new \UnexpectedValueException('no authentication parameters specified');
|
||||
|
|
|
|||
Loading…
Reference in a new issue