浏览代码

Avoid replacing covers with null when updating library (sort of closes #3194)

arkon 4 年之前
父节点
当前提交
e6bc181e7a
共有 1 个文件被更改,包括 9 次插入3 次删除
  1. 9 3
      app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt

+ 9 - 3
app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt

@@ -336,9 +336,15 @@ class LibraryUpdateService(
         // Update manga details metadata in the background
         if (preferences.autoUpdateMetadata()) {
             source.fetchMangaDetails(manga)
-                .map { networkManga ->
-                    manga.prepUpdateCover(coverCache, networkManga, false)
-                    manga.copyFrom(networkManga)
+                .map { updatedManga ->
+                    // Avoid "losing" covers
+                    if (updatedManga.thumbnail_url != null) {
+                        manga.prepUpdateCover(coverCache, updatedManga, false)
+                    } else {
+                        updatedManga.thumbnail_url = manga.thumbnail_url
+                    }
+
+                    manga.copyFrom(updatedManga)
                     db.insertManga(manga).executeAsBlocking()
                     manga
                 }