fix: encode resource names in spx resource URIs#2956
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an issue where SPX resource URIs might not correctly handle special characters in resource names. By directly applying URI encoding when generating resource URIs and enhancing the parsing logic, the system now ensures robust and consistent handling of resource identifiers, improving overall reliability. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request correctly enables URI encoding for resource names and adds comprehensive tests to cover this change. The removal of the conditional encoding logic simplifies the code. I've added one suggestion in the test file to improve the readability and maintainability of the test setup by using a helper function to create mock resource objects.
spx-gui/src/components/editor/code-editor/spx-code-editor/common.test.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR enables proper URI encoding of resource names in spx resource URIs. Previously, encoding was intentionally disabled via a shouldEncodeResourceName flag due to a language server compatibility issue. Now that the language server handles encoded URIs correctly, the workaround is removed and encodeURIComponent is used directly.
Changes:
- Removed the
encodeResourceNamewrapper function and itsshouldEncodeResourceNameflag, replacing all calls with nativeencodeURIComponent. - Added tests for
getResourceURIverifying that special characters (slashes, spaces,#,&) are properly encoded. - Added parsing tests for encoded resource names to ensure round-trip correctness.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
spx-gui/src/components/editor/code-editor/spx-code-editor/common.ts |
Removed encodeResourceName helper; replaced with direct encodeURIComponent calls in getResourceURI. |
spx-gui/src/components/editor/code-editor/spx-code-editor/common.test.ts |
Added getResourceURI encoding tests and additional parseResourceURI/parseResourceContextURI tests for encoded names. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
spx-gui/src/components/editor/code-editor/spx-code-editor/common.test.ts
Outdated
Show resolved
Hide resolved
|
Clean, well-scoped fix. Removing the |
Summary
Testing
Related