Remove unsafe from import funcs (#75)

This commit is contained in:
vms
2021-04-19 13:34:05 +03:00
committed by GitHub
parent 820e292f15
commit c702311595
29 changed files with 88 additions and 89 deletions

View File

@ -50,14 +50,14 @@ pub fn put(file_content: Vec<u8>) -> String {
return format!("file can't be written: {}", e);
}
unsafe { ipfs_put(rpc_tmp_filepath) }
ipfs_put(rpc_tmp_filepath)
}
#[fce]
pub fn get(hash: String) -> Vec<u8> {
log::info!("get called with hash: {}", hash);
let file_path = unsafe { ipfs_get(hash) };
let file_path = ipfs_get(hash);
fs::read(file_path).unwrap_or_else(|_| b"error while reading file".to_vec())
}