mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 22:37:56 +01:00 
			
		
		
		
	Use custom mime discovery in downloader
This commit is contained in:
		| @@ -14,10 +14,7 @@ import eu.kanade.tachiyomi.source.SourceManager | ||||
| import eu.kanade.tachiyomi.source.model.Page | ||||
| import eu.kanade.tachiyomi.source.online.HttpSource | ||||
| import eu.kanade.tachiyomi.source.online.fetchAllImageUrlsFromPageList | ||||
| import eu.kanade.tachiyomi.util.DynamicConcurrentMergeOperator | ||||
| import eu.kanade.tachiyomi.util.RetryWithDelay | ||||
| import eu.kanade.tachiyomi.util.plusAssign | ||||
| import eu.kanade.tachiyomi.util.saveTo | ||||
| import eu.kanade.tachiyomi.util.* | ||||
| import okhttp3.Response | ||||
| import rx.Observable | ||||
| import rx.android.schedulers.AndroidSchedulers | ||||
| @@ -26,7 +23,6 @@ import rx.subjects.BehaviorSubject | ||||
| import rx.subscriptions.CompositeSubscription | ||||
| import timber.log.Timber | ||||
| import uy.kohesive.injekt.injectLazy | ||||
| import java.net.URLConnection | ||||
|  | ||||
| /** | ||||
|  * This class is the one in charge of downloading chapters. | ||||
| @@ -407,9 +403,7 @@ class Downloader(private val context: Context, private val provider: DownloadPro | ||||
|             // Else guess from the uri. | ||||
|             ?: context.contentResolver.getType(file.uri) | ||||
|             // Else read magic numbers. | ||||
|             ?: file.openInputStream().buffered().use { | ||||
|             URLConnection.guessContentTypeFromStream(it) | ||||
|         } | ||||
|             ?: DiskUtil.findImageMime { file.openInputStream() } | ||||
|  | ||||
|         return MimeTypeMap.getSingleton().getExtensionFromMimeType(mime) ?: "jpg" | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user