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.
Related Issue
#4051
Description
Current Status
When users enter a custom URL in cline, if there are spaces before or after the URL, cline's interface will not display the spaces at the beginning and end, but the URL actually used internally by cline still contains the spaces. The display does not match the actual, which can cause request errors and make troubleshooting difficult.
This issue occurs when using the
VSCodeTextField
component with type set toURL
. The involved base components are: BaseUrlField and DebouncedTextField. The affected providers include: AskSageProvider, BedrockProvider, LiteLlmProvider, OpenAICompatibleProvider, AnthropicProvider, GeminiProvider, LMStudioProvider, and OllamaProvider.Reason
The reason for this issue is very interesting.
The
VSCodeTextField
component actually uses@microsoft/fast-foundation's
TextField. The underlying implementation of the TextField is a web-component with two-way binding functionality. During the actual execution of value binding, it directly assigns the value to the shadow element.If the type of this element is
url
, the browser environment will apply the sanitization algorithm to the value, removing spaces on both sides of the value. This is the default behavior of the browser and will only occur when the value is assigned via JavaScript. If the user enters the value directly into the input, it will not happen.Changes
Since the package of the VSCodeTextField component is no longer maintained, this change only performs a trim operation on the value when the type is url, so that the actual value matches the displayed value, and also avoids request errors caused by spaces.
Test Procedure
Type of Change
Pre-flight Checklist
npm test
) and code is formatted and linted (npm run format && npm run lint
)npm run changeset
(required for user-facing changes)Screenshots
No changes on the interface
Additional Notes
In the long term, it would be more reasonable to migrate the UI components to another component library and implement input validation.
Important
Trim spaces from URL input values in
BaseUrlField
andDebouncedTextField
to ensure consistency and prevent errors.BaseUrlField
andDebouncedTextField
to ensure consistency between displayed and actual values.onInput
handler inBaseUrlField
to trim URL values.onInput
handler inDebouncedTextField
to conditionally trim URL values based on type.tiny-pants-train.md
to document the patch.This description was created by
for d97a48a. You can customize this summary. It will automatically update as commits are pushed.