Skip to content

fix(tui): Handle file paths with hashtags#11870

Closed
saksham1341 wants to merge 2 commits intoanomalyco:devfrom
saksham1341:fix-file-name-with-hashtag-bug
Closed

fix(tui): Handle file paths with hashtags#11870
saksham1341 wants to merge 2 commits intoanomalyco:devfrom
saksham1341:fix-file-name-with-hashtag-bug

Conversation

@saksham1341
Copy link

What does this PR do?

This PR fixes #11790, improving the robustness of file path handling and line range parsing in the TUI autocomplete component.

  • Fixed Line Range Parsing: Updated extractLineRange to only treat a # as a separator if it is followed by a valid line range pattern (e.g., #123 or #123-456). This prevents filenames containing # (like file#name.txt or temp#dir/file#name.txt) from being incorrectly truncated.
  • Refactored Logic: removeLineRange now utilizes extractLineRange internally, ensuring consistent parsing behavior across the component.
  • Safe URL Construction: Replaced manual file:// string concatenation with pathToFileURL(path.resolve(...)). This ensures that special characters in file paths (spaces, #, ?, etc.) are properly percent-encoded according to URI standards, preventing broken file links in the TUI.

How did you verify your code works?

  • Create a sample temp directory.
mkdir temp
cd temp
echo -e "hello world\nhello world again\nand again" > "file#name.txt"
mkdir "temp#dir"
cp "file#name.txt" "temp#dir/file#name.txt"
  • Run opencode and tag both files, asking if they are same. The model should say that they have the same content.

Images

image

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Hey! Your PR title FIX #11990 (tui): Handle file paths with hashtags doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@saksham1341 saksham1341 changed the title FIX #11990 (tui): Handle file paths with hashtags FIX #11790 (tui): Handle file paths with hashtags Feb 3, 2026
@saksham1341 saksham1341 changed the title FIX #11790 (tui): Handle file paths with hashtags fix(tui): Handle file paths with hashtags Feb 3, 2026
@saksham1341
Copy link
Author

#11790 is now fixed by another PR, so closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: File names with # char is not properly escaped when tagging it (ENOENT)

1 participant