SAP / e-mobility-charging-stations-simulator

OCPP-J charging stations simulator
Apache License 2.0
144 stars 59 forks source link

[BUG] GetDiagnostics: FTP client incorrect access request when custom port present in the uri #1007

Closed nahueld closed 8 months ago

nahueld commented 8 months ago

Duplicate issue

Component

Simulator

Description

When trying to connect to the FTP server, we are using host instead of hostname, when a custom port is included in the uri the access fails:

        const accessResponse = await ftpClient.access({
          host: uri.host,
          ...(isNotEmptyString(uri.port) && { port: convertToInt(uri.port) }),
          ...(isNotEmptyString(uri.username) && { user: uri.username }),
          ...(isNotEmptyString(uri.password) && { password: uri.password })
        })

Version

1.2.38

Node.js version

18

System

System: OS: macOS 13.6.4 CPU: (12) arm64 Apple M2 Pro Memory: 115.53 MB / 16.00 GB Shell: 5.9 - /opt/homebrew/Cellar/zsh/5.9/bin/zsh

Expected result

The uri is parsed correctly and the client can connect to the FTP server

Actual result

The simulator can't connect to the FTP server

Steps to reproduce

No response

Attachments

No response

nahueld commented 8 months ago

I have a fix and I can push it, the fix is

    const accessResponse = await ftpClient.access({
          host: uri.hostname,
          ...(isNotEmptyString(uri.port) && { port: convertToInt(uri.port) }),
          ...(isNotEmptyString(uri.username) && { user: uri.username }),
          ...(isNotEmptyString(uri.password) && { password: uri.password })
        })