coil icon indicating copy to clipboard operation
coil copied to clipboard

Error loading .svg image in Jetpack Compose for Desktop

Open jdsdhp opened this issue 1 year ago • 3 comments

Describe the bug I am trying to load an image of type .svg in my app, but it is not allowed, and it returns an error in the onError callback. I am using Jetpack Compose for Desktop. Details are attached below.

To Reproduce

AsyncImage(
                    modifier = Modifier
                        .size(50.dp)
                        .padding(all = Paddings.tiny)
                        .clip(shape = MaterialTheme.shapes.small)
                        .border(
                            width = 2.dp,
                            color = MaterialTheme.colors.onSurface,
                            shape = MaterialTheme.shapes.small,
                        ),
                    model = workspace.avatar,
                    contentDescription = "Avatar",
                    placeholder = painterResource(Res.drawable.ic_image_placeholder),
                )

Logs/Screenshots Error(painter=null, result=ErrorResult(image=null, request=ImageRequest(context=coil3.PlatformContext$Companion$INSTANCE$1@7a121de9, data=https://bitbucket.org/workspaces/my-company/avatar/?ts=1715362523, target=coil3.compose.AsyncImagePainter$updateRequest$$inlined$target$default$1@39b9e0d1, listener=null, memoryCacheKey=null, memoryCacheKeyExtras={}, diskCacheKey=null, fileSystem=NioSystemFileSystem, fetcherFactory=null, decoderFactory=null, interceptorDispatcher=Dispatchers.Main.immediate, fetcherDispatcher=Dispatchers.IO, decoderDispatcher=Dispatchers.IO, memoryCachePolicy=ENABLED, diskCachePolicy=ENABLED, networkCachePolicy=ENABLED, placeholderMemoryCacheKey=null, placeholderFactory=interface kotlin.jvm.functions.Function1, errorFactory=interface kotlin.jvm.functions.Function1, fallbackFactory=interface kotlin.jvm.functions.Function1, sizeResolver=coil3.compose.internal.ConstraintsSizeResolver@136a3a04, scale=FIT, precision=INEXACT, extras=Extras(data={}), defined=Defined(interceptorDispatcher=null, fetcherDispatcher=null, decoderDispatcher=null, memoryCachePolicy=null, diskCachePolicy=null, networkCachePolicy=null, placeholderFactory=interface kotlin.jvm.functions.Function1, errorFactory=interface kotlin.jvm.functions.Function1, fallbackFactory=interface kotlin.jvm.functions.Function1, sizeResolver=coil3.compose.internal.ConstraintsSizeResolver@136a3a04, scale=FIT, precision=INEXACT), defaults=Defaults(fileSystem=NioSystemFileSystem, interceptorDispatcher=Dispatchers.Main.immediate, fetcherDispatcher=Dispatchers.IO, decoderDispatcher=Dispatchers.IO, memoryCachePolicy=ENABLED, diskCachePolicy=ENABLED, networkCachePolicy=ENABLED, placeholderFactory=interface kotlin.jvm.functions.Function1, errorFactory=interface kotlin.jvm.functions.Function1, fallbackFactory=interface kotlin.jvm.functions.Function1, precision=AUTOMATIC, extras=Extras(data={coil3.Extras$Key@133df82=kotlin.Unit}))), throwable=java.lang.IllegalArgumentException: Failed to Image::makeFromEncoded))

Version

    val coilVersion = "3.0.0-alpha06"
    implementation("io.coil-kt.coil3:coil-compose:$coilVersion")
    implementation("io.coil-kt.coil3:coil-compose-core:$coilVersion")
    implementation("io.coil-kt.coil3:coil-network-ktor:$coilVersion")
    implementation("io.coil-kt.coil3:coil:$coilVersion")

jdsdhp avatar Jun 24 '24 16:06 jdsdhp