NLST: return paths relative to the working directory
Based on RFC 959 NLST is intended to return information that can be used by a program to further process the files automatically.
More details here.
Returning absolute paths is simpler but it will break mget dir/*
Codecov Report
Base: 86.07% // Head: 86.25% // Increases project coverage by +0.17% :tada:
Coverage data is based on head (
f289aa0) compared to base (df4aba0). Patch coverage: 92.85% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## main #368 +/- ##
==========================================
+ Coverage 86.07% 86.25% +0.17%
==========================================
Files 11 11
Lines 1573 1600 +27
==========================================
+ Hits 1354 1380 +26
- Misses 151 152 +1
Partials 68 68
| Impacted Files | Coverage Δ | |
|---|---|---|
| handle_dirs.go | 89.04% <91.17%> (+0.56%) |
:arrow_up: |
| client_handler.go | 86.82% <100.00%> (+0.28%) |
:arrow_up: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
@fclairamb thanks for reviewing/approving this PR so quickly. This code is already included in SFTPGo v2.3.5 (I had a security related release planned for this weekend) but I prefer to wait a few more days to get feedback from the user who reported the problem and to do another code review before merging here
there is another subtle difference with ProFTPD. If you run a LIST command that points to a file not in the current directory, we return something like this:
ftp> ls dir/file.txt
200 PORT command successful
150 Using transfer connection
-rw-r--r-- 1 ftp ftp 4034 Sep 19 11:07 file.txt
226 Closing transfer connection
while ProFTPD returns this:
ftp> ls dir/file.txt
200 Comando PORT eseguito con successo
150 Apertura della connessione dati in modalità ASCII per file list
-rw-r--r-- 1 nicola nicola 4034 Sep 19 09:07 dir/file.txt
226 Trasferimento completato
NLST for files and directories and LIST for directories now return ProFTPD-like output. I will submit a new PR if I have any reports of real issues related to this different behavior