Replace urljoin with string concatenation for base URL construction#2867
Merged
adamtheturtle merged 8 commits intomainfrom Feb 22, 2026
Merged
Replace urljoin with string concatenation for base URL construction#2867adamtheturtle merged 8 commits intomainfrom
adamtheturtle merged 8 commits intomainfrom
Conversation
urljoin(base, path) silently drops any path prefix from the base URL when path starts with '/', so base_vws_url values like 'http://localhost/mock' would have '/mock' ignored. String concatenation preserves the full base URL path as intended. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Apply the same urljoin → string concatenation fix to query.py (CloudRecoService had the identical bug) - Add TestCustomBaseVWSURL::test_custom_base_url_with_path_prefix and TestCustomBaseVWQURL::test_custom_base_url_with_path_prefix to assert that a base URL containing a path prefix is preserved in the outgoing request URL; these tests would fail with the old urljoin approach Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Instead of using responses directly, set up MockVWS at the bare URL and assert ConnectionError when the client uses a path-prefix URL. With the old urljoin code the prefix would be silently dropped so the request would succeed; with string concatenation the prefix is preserved, the mock has no handler for it, and ConnectionError is raised as expected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The new release fixes the urljoin bug in MockVWS so it correctly registers handlers at path-prefixed base URLs. The path-prefix tests stay as ConnectionError tests: MockVWS listens at the bare URL while the client uses the prefixed URL, so the prefix being preserved causes a ConnectionError -- the inverse of the urljoin behaviour where the prefix would be silently dropped and the mock would respond. (A fully positive round-trip test is not yet possible because the HMAC signing also needs to incorporate the base URL path prefix, which is a separate issue.) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… URLs - Replace urljoin with string concatenation in both _vws_request.py and query.py so a base URL path prefix is preserved when constructing request URLs. - Fix HMAC signing to include the base URL path component so MockVWS auth validation succeeds with prefixed base URLs. - Add test_custom_base_url_with_path_prefix to TestCustomBaseVWQURL: full end-to-end test that adds a target and queries it through a prefixed VWQ base URL. - Add test_custom_base_url_with_path_prefix to TestCustomBaseVWSURL: verifies the prefixed URL reaches MockVWS; suppresses UnknownTargetError pending VWS-Python/vws-python-mock#2995. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
urljoin(base, path)silently drops any path prefix frombase_vws_urlwhenpathstarts with/— sobase_vws_url="http://localhost/mock"would have/mocksilently ignoredbase_vws_url.rstrip("/") + request_path) preserves the full base URL path as intendedTest plan
https://vws.vuforia.combase URL or path-less mock URLs)🤖 Generated with Claude Code
Note
Low Risk
Small change to URL assembly plus targeted tests; behavior should only differ for callers using custom base URLs with path prefixes.
Overview
Fixes URL construction for both VWS and VWQ requests by replacing
urljoinwithbase_url.rstrip("/") + request_path, preventing a custom base URL’s path prefix from being silently dropped.Adds regression tests covering custom base URLs with path prefixes for
VWS(list_targets) andCloudRecoService(query), and bumps the dev dependencyvws-python-mockto2026.2.22.2to support these cases.Written by Cursor Bugbot for commit 13a0047. This will update automatically on new commits. Configure here.