mirror of
https://github.com/ollama/ollama-python.git
synced 2026-08-24 14:33:02 -04:00
fa8509936b
The guard in Image.serialize_model compared the file extension without normalizing case, so a non-existent path with an uppercase extension (e.g. photo.PNG from a camera or a case-insensitive filesystem) skipped the "File ... does not exist" branch and fell through to the base64 path. Filenames that happen to be valid base64 (PHOTO.PNG, DCIM0001.WEBP) were then silently accepted and sent as garbage image data instead of raising, defeating the extension guard for every uppercase-extension path. Lowercase the extracted extension before the membership test so .PNG/.JPG/.JPEG/.WEBP behave the same as their lowercase counterparts. Non-image strings still correctly fall through to the base64 check. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>