FtpListItem.FullName is incorrect when giving GetListing() a complete file name.
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 50/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Tranquilla
- Stack tecnologico
- csharp
- Ambito
- networking
Direzione di ricerca
Start with FtpClient.GetListing when given a full file path, and check how FtpListItem.FullName is built from the path and the listing line. The MDTM failure in the Modify case comes from the same wrong FullName, so fixing the name should fix both. Reproduce against a server that returns one listing line for a file path, then confirm FullName equals the file path and GetModifiedTime succeeds. The issue also asks whether a single exact-name match should be treated as a file, which is a design choice to raise with maintainers before coding.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
When giving FtpClient.GetListing() a complete file name of a file in the current working directory, like so...
FtpListItem[] listing = client.GetListing("OSPE_20260629AdSvc_99.csv");
It returns a one-element array with correct information about the file, except that FullName includes the file name as both a sub-directory and file name, like so...
/home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv/OSPE_20260629AdSvc_99.csv
It should just be...
/home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv
# GetListing("OSPE_20260629AdSvc_99.csv", Auto)
Command: TYPE I
Status: Waiting for response to: TYPE I
Response: 200 Switching to Binary mode. [<1ms]
# OpenDataStream("LIST /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv", 0)
# OpenPassiveDataStream(AutoPassive, "LIST /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv", 0)
Command: EPSV
Status: Waiting for response to: EPSV
Response: 229 Entering Extended Passive Mode (|||27459|) [1ms]
Status: Connecting(sync) FtpClient.FtpSocketStream(data) IP #1 = ***:27459
Command: LIST /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv
Status: Waiting for response to: LIST /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv
Response: 150 Here comes the directory listing. [2ms]
+---------------------------------------+
Listing: -rw-r--r-- 1 1012 1012 11293 Jul 23 2026 OSPE_20260629AdSvc_99.csv
-----------------------------------------
Status: Disposing(sync) FtpClient.FtpSocketStream(data)
# CloseDataStream()
Status: Waiting for response to: LIST /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv
Response: 226 Directory send OK. [4ms]
Status: Disposing(sync) FtpClient.FtpSocketStream(data) (redundant)
Status: Confirmed format Unix
Furthermore, if FtpListOption.Modify is passed, then the incorrect path is passed to MDTM...
# GetListing("OSPE_20260629AdSvc_99.csv", Modify)
Command: TYPE I
Status: Waiting for response to: TYPE I
Response: 200 Switching to Binary mode. [<1ms]
# OpenDataStream("LIST /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv", 0)
# OpenPassiveDataStream(AutoPassive, "LIST /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv", 0)
Command: EPSV
Status: Waiting for response to: EPSV
Response: 229 Entering Extended Passive Mode (|||18732|) [1ms]
Status: Connecting(sync) FtpClient.FtpSocketStream(data) IP #1 = ***:18732
Command: LIST /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv
Status: Waiting for response to: LIST /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv
Response: 150 Here comes the directory listing. [1ms]
+---------------------------------------+
Listing: -rw-r--r-- 1 1012 1012 11293 Jul 23 2026 OSPE_20260629AdSvc_99.csv
-----------------------------------------
Status: Disposing(sync) FtpClient.FtpSocketStream(data)
# CloseDataStream()
Status: Waiting for response to: LIST /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv
Response: 226 Directory send OK. [3ms]
Status: Disposing(sync) FtpClient.FtpSocketStream(data) (redundant)
Status: Confirmed format Unix
# GetModifiedTime("/home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv/OSPE_20260629AdSvc_99.csv")
Command: MDTM /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv/OSPE_20260629AdSvc_99.csv
Status: Waiting for response to: MDTM /home/ISftp/UKG/Inbound/OSPE_20260629AdSvc_99.csv/OSPE_20260629AdSvc_99.csv
Response: 550 Could not get file modification time. [<1ms]
If I change the argument to "OSPE_20260629AdSvc_99.csv*" the problem goes away, but with obvious consequences. I can image what's going on here. The file listing returned by the server doesn't specify whether it found a file or a folder by that name. However, if only one listing is returned and its name exactly matches the argument, wouldn't it be safer to assume it was a file name? That would seem the more likely scenario than if there was a sub-folder with exactly one file with the same name as the folder. Perhaps there could be a separate method or overload for a single-file listing. I'm unable to use GetObjectInfo() as the server does not support MLST.
Using FluentFTP 54.2.0 from nuget.org. Observed in net472, net7.0, net8.0, and net9.0 TFMs. Connecting to a vsftpd server.
- Lingua principale
- C#
- Stelle
- 3.4k
- Fork
- 684
- Merge medio
- 3g 11h
- PR unite (30g)
- 4
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di robinrodricks/FluentFTP
-
enhancement help wanted major
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
robinrodricks/FluentFTP#1889 · 3 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
robinrodricks/FluentFTP#1887 ·
-
.NET maintenance response requested
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
robinrodricks/FluentFTP#1886 · 7 commenti ·
-
bug fixed Pending next release pureftpd-server workaround
Difficoltà 3/5 1-2 giorni Idoneità per principianti 57/100
robinrodricks/FluentFTP#1878 · 12 commenti ·
-
faq incorrect usage question security
Difficoltà 2/5 1-3 ore Idoneità per principianti 55/100
robinrodricks/FluentFTP#1836 · 2 commenti ·
Tutte le issue di robinrodricks/FluentFTP
Issue simili
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
erkamyaman/rust-anything#943 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
SixLabors/ImageSharp.Drawing#438 · 1 commento ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
NetSparkleUpdater/NetSparkle#762 ·
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100