Merge 38008d26dc140e60b3b087b47ed19f6cc14c6fd3 into e86aeee9c417dea66d321fd4cbbad7ffdf41b106

This commit is contained in:
Cuong-Tran 2024-12-09 01:58:21 +07:00 committed by GitHub
commit 0d7e476155
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 2 deletions

View File

@ -45,7 +45,8 @@ class DownloadProvider(
throw Exception(
context.stringResource(
MR.strings.invalid_location,
downloadsDir?.displayablePath ?: "",
(downloadsDir?.displayablePath ?: "") +
"/${getSourceDirName(source)}/${getMangaDirName(mangaTitle)}",
),
)
}

View File

@ -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) {