Downloader: Don't trust index provided by source (#8122)

This commit is contained in:
AntsyLich 2022-10-01 21:01:05 +06:00 committed by GitHub
parent 00f442b77e
commit 98c459a6b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -320,7 +320,9 @@ class Downloader(
if (pages.isEmpty()) { if (pages.isEmpty()) {
throw Exception(context.getString(R.string.page_list_empty_error)) throw Exception(context.getString(R.string.page_list_empty_error))
} }
download.pages = pages // Don't trust index from source
val reIndexedPages = pages.mapIndexed { index, page -> Page(index, page.url, page.imageUrl, page.uri) }
download.pages = reIndexedPages
} }
} else { } else {
// Or if the page list already exists, start from the file // Or if the page list already exists, start from the file