You've already forked AstralRinth
forked from didirus/AstralRinth
Merge commit '6e3bf5fbf9558dcfcfb12f65890391945e554f7e' into feature-clean
This commit is contained in:
@@ -271,6 +271,7 @@ pub struct License {
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct GalleryItem {
|
||||
pub url: String,
|
||||
pub raw_url: String,
|
||||
pub featured: bool,
|
||||
pub title: Option<String>,
|
||||
pub description: Option<String>,
|
||||
@@ -703,6 +704,16 @@ impl CachedEntry {
|
||||
.await?;
|
||||
|
||||
for row in query {
|
||||
let row_exists = row.data.is_some();
|
||||
let parsed_data = row
|
||||
.data
|
||||
.and_then(|x| serde_json::from_value::<CacheValue>(x).ok());
|
||||
|
||||
// If data is corrupted/failed to parse ignore it
|
||||
if row_exists && parsed_data.is_none() {
|
||||
continue;
|
||||
}
|
||||
|
||||
if row.expires <= Utc::now().timestamp() {
|
||||
if cache_behaviour == CacheBehaviour::MustRevalidate {
|
||||
continue;
|
||||
@@ -727,10 +738,7 @@ impl CachedEntry {
|
||||
.unwrap_or(false)
|
||||
});
|
||||
|
||||
if let Some(data) = row
|
||||
.data
|
||||
.and_then(|x| serde_json::from_value::<CacheValue>(x).ok())
|
||||
{
|
||||
if let Some(data) = parsed_data {
|
||||
return_vals.push(Self {
|
||||
id: row.id,
|
||||
alias: row.alias,
|
||||
|
||||
@@ -501,13 +501,8 @@ impl Profile {
|
||||
|
||||
pub async fn remove(
|
||||
profile_path: &str,
|
||||
transaction: &mut sqlx::Transaction<'_, sqlx::Sqlite>,
|
||||
pool: &SqlitePool,
|
||||
) -> crate::Result<()> {
|
||||
if let Ok(path) = crate::api::profile::get_full_path(profile_path).await
|
||||
{
|
||||
io::remove_dir_all(&path).await?;
|
||||
}
|
||||
|
||||
sqlx::query!(
|
||||
"
|
||||
DELETE FROM profiles
|
||||
@@ -515,9 +510,14 @@ impl Profile {
|
||||
",
|
||||
profile_path
|
||||
)
|
||||
.execute(&mut **transaction)
|
||||
.execute(pool)
|
||||
.await?;
|
||||
|
||||
if let Ok(path) = crate::api::profile::get_full_path(profile_path).await
|
||||
{
|
||||
io::remove_dir_all(&path).await?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user