rust-ftp icon indicating copy to clipboard operation
rust-ftp copied to clipboard

File size increase on download tranfer

Open MarcAntoine-Arnaud opened this issue 7 years ago • 5 comments

Trying to use the library (on file who made 80Mo), I get a file with 81677962 bytes which become after the download to a size of 81969152.

I have take a look on the difference, and I found some additional bytes on 0x0A which was converted to 0x0D 0x0A. Do you have any idea of the issue ?

MarcAntoine-Arnaud avatar Jan 30 '18 16:01 MarcAntoine-Arnaud

Just a remark, I obtain similar result using simple_retr or retr methods.

MarcAntoine-Arnaud avatar Jan 30 '18 17:01 MarcAntoine-Arnaud

I made an another test on a small file (296164 and I got 308048). source look like:

00000000  ef bb bf 57 45 42 56 54  54 0d 0a 0d 0a 30 30 3a  |...WEBVTT....00:|
00000010  30 30 3a 30 30 2e 30 30  30 20 2d 2d 3e 20 30 30  |00:00.000 --> 00|
00000020  3a 30 30 3a 30 38 2e 32  34 30 0d 0a 2d 20 44 2e  |:00:08.240..- D.

and I wrote:

00000000  ef bb bf 57 45 42 56 54  54 0d 0d 0a 0d 0d 0a 30  |...WEBVTT......0|
00000010  30 3a 30 30 3a 30 30 2e  30 30 30 20 2d 2d 3e 20  |0:00:00.000 --> |
00000020  30 30 3a 30 30 3a 30 38  2e 32 34 30 0d 0d 0a 2d  |00:00:08.240...-|

MarcAntoine-Arnaud avatar Jan 30 '18 17:01 MarcAntoine-Arnaud

Changing the unit test test data\n with "test data\nmore and more\n\nTHE END." will show you the problem. I got: [116, 101, 115, 116, 32, 100, 97, 116, 97, 13, 10, 109, 111, 114, 101, 32, 97, 110, 100, 32, 109, 111, 114, 101, 13, 10, 13, 10, 84, 72, 69, 32, 69, 78, 68, 46, 13, 10], instead of: [116, 101, 115, 116, 32, 100, 97, 116, 97, 10, 109, 111, 114, 101, 32, 97, 110, 100, 32, 109, 111, 114, 101, 10, 10, 84, 72, 69, 32, 69, 78, 68, 46]

MarcAntoine-Arnaud avatar Jan 31 '18 08:01 MarcAntoine-Arnaud

@MarcAntoine-Arnaud have same problem set transfer_type to FileType::Binary helps

ftp_stream.transfer_type(FileType::Binary);

https://users.rust-lang.org/t/solved-ftp-upload-any-file/7107/4

igorivaniuk avatar Jul 05 '18 15:07 igorivaniuk

This should be included in README (or examples), I got stuck 2 hours trying to understand why my .gz file could not decompress.

vlourme avatar Aug 27 '23 09:08 vlourme