ftp icon indicating copy to clipboard operation
ftp copied to clipboard

Add Stat based on MLST command

Open panthony opened this issue 3 years ago • 6 comments

Hi,

The idea of this new method is provide a more efficient way to lookup a single entry when supported by the remote server.

I exposed a new ErrNotSupported error to ease the detection of an unsupported method & implement a fallback strategy.

There is a subtle difference between MLST and MLSD, the former has a space in front of each line entry (except BEGIN/END), I was not sure if the trim should be done here or in parseRFC3659ListLine.

I'm not sure if Stat is the appropriate name though, it matches the commonly used os.Stat() function but there is a STAT FTP command (that does something else entirely.)

panthony avatar Jun 08 '22 07:06 panthony

Very useful thank you :-)

ncw avatar Jun 08 '22 10:06 ncw

Coverage Status

Coverage decreased (-1.8%) to 72.326% when pulling 30f31b98d5ce502ff5063bdc3208d73ad32810ee on cogniteev:add-mlst-command into dfa1e758f3afefbee42e95d49116bff8e1e536bc on jlaffaye:master.

coveralls avatar Jun 10 '22 16:06 coveralls

Can you please add a test case for this new function ? Also, I agree, we should come with a better name since Stat is confusing.

jlaffaye avatar Jun 10 '22 16:06 jlaffaye

Could be GetEntry, GetEntryInfo, ..

For the test there are none for the ftp.go file thus I'm not quite sure how to bootstrap one, I'll try to get a look if I got the time.

panthony avatar Jun 13 '22 06:06 panthony

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 31 '22 00:07 stale[bot]

Would GetEntryInfo be fine?

panthony avatar Aug 02 '22 06:08 panthony

Dup: https://github.com/jlaffaye/ftp/pull/269

jlaffaye avatar Aug 16 '22 16:08 jlaffaye