Skip to content

Conversation

@vivekfyi
Copy link
Contributor

@vivekfyi vivekfyi commented Jul 9, 2025

Fixes copyLink function for the files and folder with special character in their name

Related GitHub Issue

Closes: #4687

Roo Code Task Context (Optional)

NA

Description

passing filePath to decodeURIComponent to correctly decode special characters like "["
Why: This was breaking openFile functionality where folder/file name contains special character.

Test Procedure

Created a sample directory similar with following files

src/
src/[notwork]/
src/[notwork]/tst.txt
src/work/
src/work/test2.txt

Prompt Roo Code in code mode to "response me with all the file in the project"
This will list files tst.txt and test2.txt both should open correctly on clicking. Verified this.

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

State Demo Link
Before Fix View Demo
After Fix View Demo

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

Fixes openFile in open-file.ts to handle special characters in file paths using decodeURIComponent.

  • Behavior:
    • Fixes openFile function in open-file.ts to correctly handle file paths with special characters by using decodeURIComponent.
    • Ensures files and folders with special characters like [ can be opened correctly.
  • Testing:
    • Verified with a directory structure containing special characters in file and folder names.

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

@vivekfyi vivekfyi requested review from cte, jr and mrubens as code owners July 9, 2025 11:28
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 9, 2025
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Jul 9, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jul 9, 2025
@hannesrudolph hannesrudolph added PR - Needs Preliminary Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jul 9, 2025
- Added try-catch block around decodeURIComponent to handle invalid escape sequences
- Falls back to original path if decoding fails
- Added comprehensive unit tests for the openFile function
- Tests cover invalid URI encoding, valid encoding, and various edge cases
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jul 9, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution! I added some tests and also improved error handling a bit.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jul 9, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Jul 9, 2025
@mrubens mrubens merged commit 7a8848d into RooCodeInc:main Jul 9, 2025
17 checks passed
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jul 9, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 9, 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 lgtm This PR has been approved by a maintainer PR - Needs Review size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Could not open file: Path does not exist for [slug] type folder

4 participants