Skip to content

fix: strip whitespace from host values#691

Open
lin-hongkuan wants to merge 1 commit into
ollama:mainfrom
lin-hongkuan:codex/strip-host-whitespace
Open

fix: strip whitespace from host values#691
lin-hongkuan wants to merge 1 commit into
ollama:mainfrom
lin-hongkuan:codex/strip-host-whitespace

Conversation

@lin-hongkuan

Copy link
Copy Markdown

Summary

  • Strip leading and trailing whitespace before parsing explicit host values.
  • Cover host strings with schemes, ports, and paths.

Why

Values copied into OLLAMA_HOST or passed as a host argument can include surrounding whitespace. Without trimming, host parsing can produce an invalid base URL or raise while parsing the port.

Testing

  • python -m pytest tests/test_client.py::test_parse_host_strips_whitespace tests/test_client.py::test_headers -q
  • git diff --check

@vaderollama vaderollama left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — strips whitespace from host values before parsing, preventing invalid base URLs from copy-pasted OLLAMA_HOST values with trailing spaces/newlines. Tests cover scheme, port, and path combinations with spaces, tabs, and newlines. Small and correct.

@ParthSareen — ready to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants