mirror of
https://github.com/ViViDboarder/bitwarden_rs.git
synced 2024-11-22 21:26:38 +00:00
Fixed issue #709 creating icon_cache directory.
When the icon_cache directory doesn't exists yet, and the first icon catched is a miss this .miss file was not able to be created since the directory was only created during a valid icon download.
This commit is contained in:
parent
07e0fdbd2a
commit
ca7c5129b2
@ -104,6 +104,9 @@ fn get_icon(domain: &str) -> Vec<u8> {
|
|||||||
return FALLBACK_ICON.to_vec();
|
return FALLBACK_ICON.to_vec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create icon_cache_folder before fetching
|
||||||
|
create_dir_all(&CONFIG.icon_cache_folder()).expect("Error creating icon cache");
|
||||||
|
|
||||||
// Get the icon, or fallback in case of error
|
// Get the icon, or fallback in case of error
|
||||||
match download_icon(&domain) {
|
match download_icon(&domain) {
|
||||||
Ok(icon) => {
|
Ok(icon) => {
|
||||||
@ -395,8 +398,6 @@ fn download_icon(domain: &str) -> Result<Vec<u8>, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn save_icon(path: &str, icon: &[u8]) {
|
fn save_icon(path: &str, icon: &[u8]) {
|
||||||
create_dir_all(&CONFIG.icon_cache_folder()).expect("Error creating icon cache");
|
|
||||||
|
|
||||||
if let Ok(mut f) = File::create(path) {
|
if let Ok(mut f) = File::create(path) {
|
||||||
f.write_all(icon).expect("Error writing icon file");
|
f.write_all(icon).expect("Error writing icon file");
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user