mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -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
ed055d6a7a
commit
f7c97e6c9f
1 changed files with 5 additions and 2 deletions
|
|
@ -62,9 +62,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