ashkulz / NppFTP

Plugin for Notepad++ allowing FTP, FTPS, FTPES and SFTP communications
https://ashkulz.github.io/NppFTP/
320 stars 93 forks source link

[BUG] Cannot download files via IPv6 #318

Open reenlam opened 3 years ago

reenlam commented 3 years ago

Description of the Issue

When connected to a server via IPv6, it is impossible to download a file because of incorrect directory name being created (a directory name contains colons as in IPv6 address syntax - unfortunately in case of Windows OS, colon is forbidden in a directory name).

Steps to Reproduce the Issue

  1. Using NppFTP, connect to some server using IPv6 (use it as hostname in your connection profile configuration). For convenience you can use a link-local IPv6 address of some host in your local network.
  2. Try to download/modify a file
  3. You are getting an error indicating that download of the file failed, because the directory could not be created (you can notice that the path contains a directory with your hostname - and this includes colons which are not allowed in case of Windows OS.

How it could be resolved

The simplest solution would be just replacing colons with some other character (e.g. underscore) when creating a directory.

NOTE: there is some other, similar bug in NppFTP. When connecting via IPv4 and downloading a file which contains colons in its name, it is stored locally with colons replaced by underscores - however, when you modify this file and save, it is uploaded with a new filename containing underscores (so on the remote host, there is a new file created instead of modifying the existing one).

Debug Information

Notepad++ v8.1.2 (64-bit) Build time : Jul 16 2021 - 01:59:50 Command Line : Admin mode : OFF Local Conf mode : OFF Cloud Config : OFF Current ANSI codepage : 1250 Plugins : ComparePlugin.dll mimeTools.dll NppConverter.dll NppExport.dll NppFTP.dll

chcg commented 2 years ago

As a workaround maybe https://github.com/ashkulz/NppFTP/blob/master/docs/index.md#cache-paths could be used to avoid that automatically a invalid dirname from the IPv6 address is created. The general issue is the filename/dirname limitation on windows, see https://stackoverflow.com/questions/1976007/what-characters-are-forbidden-in-windows-and-linux-directory-names. So probably this would require a mapping table of the stripped windows filenames to the full unix names. Additionally this mapping table needs to be persistent I think.

@renlaam Is it really possible to use a IPv6 address as hostname? From the code I would say IPv6 is not usable yet. I tested with a locally running FTP server at ::1 and that is not usable.

reenlam commented 2 years ago

Is it really possible to use a IPv6 address as hostname? From the code I would say IPv6 is not usable yet. I tested with a locally running FTP server at ::1 and that is not usable.

Yes, it is possible, I can connect to my raspberryPI using a link-local IPv6 address (from fe80::/10 pool) as hostname without any problem. Are you sure the FTP server you tested supported IPv6 / had been configured to accept IPv6?