Skip to content

Commit

Permalink
fix missing result of get_from
Browse files Browse the repository at this point in the history
  • Loading branch information
justprosh committed Jul 1, 2021
1 parent 25c08ac commit 9cdcfb8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pure/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module_manifest!();
#[derive(Deserialize, Serialize)]
pub struct Config {
pub timeout: u64,
pub multiaddr: Option<String>
pub multiaddr: Option<String>,
}

fn save_multiaddr(multiaddr: String) {
Expand All @@ -59,10 +59,11 @@ pub(crate) fn create_config() {
if fs::metadata(CONFIG_FILE_PATH).is_err() {
write_config(Config {
timeout: DEFAULT_TIMEOUT_SEC,
multiaddr: None
multiaddr: None,
});
}
}

pub fn main() {
WasmLoggerBuilder::new()
.with_log_level(log::LevelFilter::Info)
Expand Down Expand Up @@ -97,7 +98,13 @@ pub fn get_from(hash: String, multiaddr: String) -> IpfsResult {

let particle_vault_path = format!("/tmp/vault/{}", particle_id);
let file_path = format!("{}/{}", particle_vault_path, hash);
ipfs_get(hash, file_path, timeout)
let get_result = ipfs_get(hash, file_path.clone(), timeout);

return if get_result.success {
IpfsResult { success: true, result: file_path }
} else {
get_result
}
}

#[marine]
Expand Down

0 comments on commit 9cdcfb8

Please sign in to comment.