[Bug]: API img2img not accepting bare base64 strings
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
In the prototype version of API, the img2img accepts both data URLs and bare base64 strings. But recently I found that it only accept data URLs now, since the PR #3511 . If you still request the API with bare base64 strings, it would report an error like
File "/***/stable-diffusion-webui/modules/api/api.py", line 84, in img2imgapi
mask = decode_base64_to_image(mask)
File "/***/stable-diffusion-webui/venv/lib/python3.10/site-packages/gradio/processing_utils.py", line 45, in decode_base64_to_image
content = encoding.split(";")[1]
IndexError: list index out of range
Steps to reproduce the problem
- Run webui with
--api - Request the api
/sdapi/v1/img2imgwith base64 encoded image - Error occurred.
What should have happened?
I think it should accept both type of it, just like the prototype did.
Commit where the problem happens
07d1bd426722b4c53b38ff682c5aab53177d8530
What platforms do you use to access UI ?
Windows, Linux
What browsers do you use to access the UI ?
Google Chrome
Command Line Arguments
--api
Additional information, context and logs
cc @bamarillo
The standard way is dataURLs, this is inline with the new gradio return format which also used to be base64 only but now dataURLs.
Sure, I can fix my code to use data URLs in requesting the API. But I think it still is better to catch the exception?
fixed in https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/4977