mirror of
https://github.com/alibaba/open-code-review.git
synced 2026-08-22 23:24:48 +00:00
* fix: ensureMessagesSuffix double-paths URLs ending with /v1 The old check uses strings.Contains(u, '/v1/') which misses URLs that end with /v1 (no trailing slash after trim). This causes https://api.anthropic.com/v1/ to become /v1/v1/messages. Also, Contains matches /v1/ anywhere in the URL including in hostnames or unrelated path segments, causing false positives. Fix: use HasSuffix to check for /v1/messages and /v1 endings. * test: add comprehensive tests for ensureMessagesSuffix * fix: revert unrelated encoding corruption in resolver_test.go The previous commit introduced UTF-8 mojibake (em-dash U+2014 replaced with Latin-1 bytes) in unrelated test comments. This commit restores the upstream file content verbatim and keeps only the new TestEnsureMessagesSuffix test function. * fix: revert unrelated encoding corruption in resolver.go Restore upstream file encoding, keeping only the ensureMessagesSuffix fix. * fix: preserve pass-through for proxy URLs with /v1/ mid-path Add back a Contains('/v1/') guard after the HasSuffix checks so that proxy URLs like https://proxy.com/v1/anthropic are returned as-is instead of getting /v1/messages appended. * test: add proxy URL with /v1/ mid-path test case |
||
|---|---|---|
| .. | ||
| bpe_data | ||
| client.go | ||
| client_test.go | ||
| embedded_loader.go | ||
| embedded_loader_test.go | ||
| message_test.go | ||
| protocol.go | ||
| protocol_test.go | ||
| providers.go | ||
| providers_test.go | ||
| resolver.go | ||
| resolver_test.go | ||
| responses_client.go | ||
| responses_client_test.go | ||
| usage_resolver.go | ||
| usage_resolver_test.go | ||