Problems with ffsend_api crate

Hello rustaceans,
I am relatively new to programming in rust, and I am having a problem with the ffsend_api crate. All seems to work when I run the program, however the file doesn't seem to actually upload to firefox send, because when I follow the link, this shows:

What am I doing wrong in my code? I have googled around and looked through the source code of the crate, and cant seem to figure it out.

use ffsend_api::action::upload::Upload;
use ffsend_api::api::Version;

use ffsend_api::client::Client;

use ffsend_api::file::remote_file::RemoteFile;
use ffsend_api::client::ClientConfigBuilder;
use url::Url;
use std::time::Duration;
use ffsend_api::action::params::ParamsData;
use ffsend_api::action::upload::Error;

use std::path::PathBuf;

fn main() {

fn encryptedsend(path: String) -> Result<RemoteFile, Error> {
    let mut clientbuilder = ClientConfigBuilder::default();
    let clientbuilder2 = clientbuilder.basic_auth(Option::from(("".to_string(), Option::None)))
    let sendme = Upload::new(
        Version::V3,  //version of firefox send v2 or v3
        PathBuf::from(path.clone()), //path
        Option::from(path.clone()), //set title of file
        Option::from(ParamsData::from(Option::from(1) /* only one download allowed */, Option::from(3600)))
        &Client::new(clientbuilder2.unwrap().clone(), true),

Hi there. Developer of ffsend and ffsend-api here.

The problem here is that you aren't using the correct URL for downloading a file. The URL shown in the output of your snippet does not include the secret that is required to decrypt the file. When this is missing, the Firefox Send webpage just assumes the file has expired.

The RemoteFile object that you get back after uploading has a helper function to obtain the download URL including the secret named download_url(...). Simply use the URL it outputs by modifying your println! statement to something like this:


I'm sorry this isn't really clearly explained in the documentation. I'm planning to reorganize the API crate some time, and to improve its documentation.

Feel free to open an issue over on GitHub/GitLab in the ffsend-api repository for any further issues like this.

Hope this helps!

Thank you! That worked like a charm. I'm definitely planning on using ffsend_api often in my programs.

1 Like

That's awesome! Sorry for the issue.

I might add a simple upload example to the repository in the mean time.