From 8c18edc4c708471ddee64a90a03719e9501f1610 Mon Sep 17 00:00:00 2001 From: Cuong-Tran Date: Tue, 5 Nov 2024 13:35:14 +0700 Subject: [PATCH 1/2] more detail notification on invalid download location --- .../java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt index 2ab5e55d9b..5483281181 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadProvider.kt @@ -45,7 +45,8 @@ class DownloadProvider( throw Exception( context.stringResource( MR.strings.invalid_location, - downloadsDir?.displayablePath ?: "", + (downloadsDir?.displayablePath ?: "") + + "/${getSourceDirName(source)}/${getMangaDirName(mangaTitle)}", ), ) } From 38008d26dc140e60b3b087b47ed19f6cc14c6fd3 Mon Sep 17 00:00:00 2001 From: Cuong-Tran Date: Tue, 5 Nov 2024 14:08:43 +0700 Subject: [PATCH 2/2] fix: download job stops all together even if 1 entry is failed to create directory --- .../eu/kanade/tachiyomi/data/download/Downloader.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index 0ca27494dc..fd9a692270 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -315,7 +315,15 @@ class Downloader( * @param download the chapter to be downloaded. */ private suspend fun downloadChapter(download: Download) { - val mangaDir = provider.getMangaDir(download.manga.title, download.source) + val mangaDir: UniFile + try { + mangaDir = provider.getMangaDir(download.manga.title, download.source) + } catch (error: Exception) { + logcat(LogPriority.ERROR, error) + download.status = Download.State.ERROR + notifier.onError(error.message, download.chapter.name, download.manga.title, download.manga.id) + return + } val availSpace = DiskUtil.getAvailableStorageSpace(mangaDir) if (availSpace != -1L && availSpace < MIN_DISK_SPACE) {