rsfbclient icon indicating copy to clipboard operation
rsfbclient copied to clipboard

Update Vec<u8> does not load the file entirely

Open PauloCotrim opened this issue 2 years ago • 6 comments

loading pdf files on update, they are stored corrupted, even using read_to_end() in the file to get the vector

PauloCotrim avatar Nov 23 '24 13:11 PauloCotrim

Can you provide some sample code? Does this only happen with PDFs? What version are you using (native/pure rust)?

fernandobatels avatar Nov 24 '24 19:11 fernandobatels

        let output = format!("/home/users/Downloads/tmp/{id}.pdf");
        let mut buf_out = Vec::new();
        let mut file_output_tmp = File::open(&output)?;
        file_output_tmp.read_to_end(&mut buf_out)?;
        fdb_update.execute("update anexos set anexo = ? where id_anexo = ?", (buf_out,id))?;
        
        file_output_tmp.flush()?;
        remove_file(output)?;

using native.

PauloCotrim avatar Nov 24 '24 21:11 PauloCotrim

There seems to be a problem in the native implementation when the data is 65536 bytes or longer. For the time being you can use the native rust implementation.

jairinhohw avatar Nov 25 '24 02:11 jairinhohw

@PauloCotrim can you test the solution provided ?

fernandobatels avatar Nov 26 '24 12:11 fernandobatels

Yes, I tested it and it worked.

PauloCotrim avatar Nov 26 '24 19:11 PauloCotrim

New 0.25.1 version released. Thanks @jairinhohw

fernandobatels avatar Nov 27 '24 09:11 fernandobatels