fix: Handle empty url issue.
This commit is contained in:
parent
a4cb28ba81
commit
1893904135
@ -7,6 +7,7 @@ import android.webkit.WebView
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import bou.amine.apps.readerforselfossv2.android.utils.CircleImageView
|
import bou.amine.apps.readerforselfossv2.android.utils.CircleImageView
|
||||||
import bou.amine.apps.readerforselfossv2.service.AppSettingsService
|
import bou.amine.apps.readerforselfossv2.service.AppSettingsService
|
||||||
|
import bou.amine.apps.readerforselfossv2.utils.isEmptyOrNullOrNullString
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
import com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||||
import com.bumptech.glide.load.model.GlideUrl
|
import com.bumptech.glide.load.model.GlideUrl
|
||||||
@ -24,6 +25,9 @@ private const val PRELOAD_IMAGE_TIMEOUT = 10000
|
|||||||
|
|
||||||
@OptIn(ExperimentalEncodingApi::class)
|
@OptIn(ExperimentalEncodingApi::class)
|
||||||
fun String.toGlideUrl(appSettingsService: AppSettingsService): GlideUrl {
|
fun String.toGlideUrl(appSettingsService: AppSettingsService): GlideUrl {
|
||||||
|
if (this.isEmptyOrNullOrNullString()) {
|
||||||
|
return GlideUrl("")
|
||||||
|
}
|
||||||
if (appSettingsService.getBasicUserName().isNotEmpty()) {
|
if (appSettingsService.getBasicUserName().isNotEmpty()) {
|
||||||
val authString = "${appSettingsService.getBasicUserName()}:${appSettingsService.getBasicPassword()}"
|
val authString = "${appSettingsService.getBasicUserName()}:${appSettingsService.getBasicPassword()}"
|
||||||
val authBuf = Base64.encode(authString.toByteArray(Charsets.UTF_8))
|
val authBuf = Base64.encode(authString.toByteArray(Charsets.UTF_8))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user