mirror of
https://github.com/aljazceru/notedeck.git
synced 2025-12-20 01:44:19 +01:00
image-cache: remove expect
This commit is contained in:
@@ -82,7 +82,12 @@ impl ImageCache {
|
|||||||
/// Migrate from base32 encoded url to sha256 url + sub-dir structure
|
/// Migrate from base32 encoded url to sha256 url + sub-dir structure
|
||||||
pub fn migrate_v0(&self) -> Result<()> {
|
pub fn migrate_v0(&self) -> Result<()> {
|
||||||
for file in std::fs::read_dir(&self.cache_dir)? {
|
for file in std::fs::read_dir(&self.cache_dir)? {
|
||||||
if let Ok(file) = file {
|
let file = if let Ok(f) = file {
|
||||||
|
f
|
||||||
|
} else {
|
||||||
|
// not sure how this could fail, skip entry
|
||||||
|
continue;
|
||||||
|
};
|
||||||
if !file.path().is_file() {
|
if !file.path().is_file() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -110,7 +115,6 @@ impl ImageCache {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -208,7 +208,9 @@ impl Notedeck {
|
|||||||
let app_rect_handler = AppSizeHandler::new(&path);
|
let app_rect_handler = AppSizeHandler::new(&path);
|
||||||
|
|
||||||
// migrate
|
// migrate
|
||||||
img_cache.migrate_v0().expect("img-cache migration");
|
if let Err(e) = img_cache.migrate_v0() {
|
||||||
|
error!("error migrating image cache: {e}");
|
||||||
|
}
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
ndb,
|
ndb,
|
||||||
|
|||||||
Reference in New Issue
Block a user