mirror of
https://github.com/fluencelabs/marine.git
synced 2025-06-23 11:41:38 +00:00
Remove unsafe from import funcs (#75)
This commit is contained in:
Binary file not shown.
Binary file not shown.
@ -54,7 +54,7 @@ pub fn put(file_path: String) -> String {
|
||||
file_path,
|
||||
];
|
||||
|
||||
let ipfs_result = unsafe { ipfs(cmd) };
|
||||
let ipfs_result = ipfs(cmd);
|
||||
ipfs_result
|
||||
.into_std()
|
||||
.unwrap()
|
||||
@ -78,7 +78,7 @@ pub fn get(hash: String) -> String {
|
||||
hash,
|
||||
];
|
||||
|
||||
unsafe { ipfs(cmd) };
|
||||
ipfs(cmd);
|
||||
RESULT_FILE_PATH.to_string()
|
||||
}
|
||||
|
||||
|
@ -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())
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user