Open EternalNight996 opened 6 months ago
I have found the problem, but please do not handle line breaks on different platforms; Adding the following code solves this problem; So I have the following proposal: for FPT uploads, we can increase the recognition of the FTP server platform; Then process the data; Secondly, increase the judgment of file types and only handle text types;
Let mut buffer=Vec:: new();
Let mut f=fs:: File:: open (src). unwrap();
Let mut reader=f
. readuto_end (&mut buffer)
. map (| _ |{
//Iterate over multiple references to each byte and replace '\ n' with '\ n'
//Use map to replace '\ n' with '\ n' and collect into a new Vec<u8>
Let modified_data: Vec<u8>=buffer
. iter()
. map (|&byte |{
If byte==b '\ n'{
Vec! [b '\ r', b '\ n']
}Else{
Vec! [byte]
}
})
. flatten()
. collect();
Cursor:: new (modified_data)
})
. map_err (FtpError: ConnectionError)?;
The Upload code of Core