Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NLST: return paths relative to the working directory #368

Merged
merged 2 commits into from
Sep 22, 2022

Conversation

drakkan
Copy link
Collaborator

@drakkan drakkan commented Sep 17, 2022

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
Copy link

codecov bot commented Sep 17, 2022

Codecov Report

Base: 86.07% // Head: 86.25% // Increases project coverage by +0.17% 🎉

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%) ⬆️
client_handler.go 86.82% <100.00%> (+0.28%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@drakkan drakkan changed the title NLST: return absolute paths NLST: return paths relative to the working directory Sep 17, 2022
Copy link
Owner

@fclairamb fclairamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@drakkan
Copy link
Collaborator Author

drakkan commented Sep 18, 2022

@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

@drakkan
Copy link
Collaborator Author

drakkan commented Sep 19, 2022

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

Based on RFC 959 NLST is intended to return information that can be used
by a program to further process the files automatically.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants