mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 03:07:25 +01:00
Remove covers on error. #334
This commit is contained in:
parent
93fc5944f3
commit
59b90a94d0
@ -29,10 +29,15 @@ class MangaDataFetcher(private val networkFetcher: DataFetcher<InputStream>,
|
|||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
file.parentFile.mkdirs()
|
file.parentFile.mkdirs()
|
||||||
networkFetcher.loadData(priority)?.let {
|
networkFetcher.loadData(priority)?.let {
|
||||||
it.use { input ->
|
try {
|
||||||
file.outputStream().use { output ->
|
it.use { input ->
|
||||||
input.copyTo(output)
|
file.outputStream().use { output ->
|
||||||
|
input.copyTo(output)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
file.delete()
|
||||||
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user