mirror of
https://github.com/nextcloud/server.git
synced 2026-02-19 02:38:40 -05:00
Merge pull request #58350 from nextcloud/regressionEmptyPort
fix(sftp): Handle empty port parameter to allow host-defined ports
This commit is contained in:
commit
f06133bf13
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