From a84305438853cafa9aff194b89fa221603f2f743 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 23 Jul 2022 11:13:52 -0400 Subject: [PATCH] Show better error when trying to open RARv5 file --- .../eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt | 7 ++++++- app/src/main/res/values/strings.xml | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt index e3049ae1a..0fafa2e97 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/ChapterLoader.kt @@ -1,6 +1,7 @@ package eu.kanade.tachiyomi.ui.reader.loader import android.content.Context +import com.github.junrar.exception.UnsupportedRarV5Exception import eu.kanade.domain.manga.model.Manga import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.download.DownloadManager @@ -85,7 +86,11 @@ class ChapterLoader( when (format) { is LocalSource.Format.Directory -> DirectoryPageLoader(format.file) is LocalSource.Format.Zip -> ZipPageLoader(format.file) - is LocalSource.Format.Rar -> RarPageLoader(format.file) + is LocalSource.Format.Rar -> try { + RarPageLoader(format.file) + } catch (e: UnsupportedRarV5Exception) { + error(context.getString(R.string.loader_rar5_error)) + } is LocalSource.Format.Epub -> EpubPageLoader(format.file) } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e09345dbe..19947c6b6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -721,6 +721,7 @@ Failed to load pages: %1$s No pages found Source not found + RARv5 format is not supported Skipping %d chapter, either the source is missing it or it has been filtered out Skipping %d chapters, either the source is missing them or they have been filtered out