Skip to content

Fix Ollama API URL normalization by removing trailing slashes #6079

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Naam
Copy link

@Naam Naam commented Jul 22, 2025

Related GitHub Issue

Closes: #6078

Roo Code Task Context (Optional)

Description

Ensures consistent behavior when constructing API endpoint URLs by normalizing the base URL to remove any trailing slashes. This prevents issues when the base URL is provided with trailing slashes.

Test Procedure

Added tests to verify URL normalization works correctly with:

  • URLs with a single trailing slash
  • URLs with multiple trailing slashes
  • URLs without trailing slashes

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Documentation Updates

Does this PR necessitate updates to user-facing documentation?

  • No documentation updates are required.
  • Yes, documentation updates are required. (Please describe what needs to be updated or link to a PR in the docs repository).

Additional Notes

Get in Touch


Important

Normalize ollamaBaseUrl in CodeIndexOllamaEmbedder to remove trailing slashes, ensuring consistent API endpoint construction.

  • Behavior:
    • Normalize ollamaBaseUrl in CodeIndexOllamaEmbedder constructor to remove trailing slashes.
    • Ensures consistent API endpoint construction.
  • Tests:
    • Added tests in ollama.spec.ts for URLs with single, multiple, and no trailing slashes.
    • Verifies that API calls use normalized URLs without trailing slashes.

This description was created by Ellipsis for 2f6d6f9. You can customize this summary. It will automatically update as commits are pushed.

Ensures consistent behavior when constructing API endpoint URLs by
normalizing the base URL to remove any trailing slashes. This prevents
issues when the base URL is provided with trailing slashes.

Added tests to verify URL normalization works correctly with:
- URLs with a single trailing slash
- URLs with multiple trailing slashes
- URLs without trailing slashes
@Naam Naam requested review from mrubens, cte and jr as code owners July 22, 2025 20:50
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. bug Something isn't working labels Jul 22, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:M This PR changes 30-99 lines, ignoring generated files.
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

Ollama URL normalization (leading to issues like #5007) does not clean trailing /
2 participants