#9389·kivy

CoreImage passes text to BytesIO for non-base64 data URIs

Author: AGFACBNNRCreated Oct 1, 2026Updated Oct 1, 2026

A non-base64 data URI leaves its payload as str, then Image.__init__() passes it to BytesIO.

python
from base64 import b64decode
from urllib.parse import quote_from_bytes
from kivy.core.image import Image

# A 1×1 GIF, encoded as a percent-escaped data URI.
gif = b64decode("R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7")
Image("data:image/gif," + quote_from_bytes(gif))
# TypeError: a bytes-like object is required, not 'str'

Expected: decode the payload into bytes, or explicitly reject unsupported data URI encodings before image loading.

The non-base64 branch needs byte conversion; percent-escaped data requires URI decoding rather than plain UTF-8 encoding.

The byte/text failure was reproduced with the original Python constructor isolated from the graphical backend; a full GUI run was not performed.