fix: Handle empty url issue.
All checks were successful
Check master code / build (push) Successful in 10m53s
Create tag / build (push) Successful in 7m40s
Create tag / createTagAndChangelog (push) Successful in 38s
Create tag / release (push) Successful in 5m3s

This commit is contained in:
Amine Bouabdallaoui 2025-01-19 14:48:29 +01:00
parent a4cb28ba81
commit 1893904135

View File

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