Skip to content

Comments

fix: handle special characters like '#' in directory and file names (fixes issue 750)#764

Open
ed-scherer wants to merge 4 commits intomicrosoft:mainfrom
protizmo:fix/750-folder-hash-preview
Open

fix: handle special characters like '#' in directory and file names (fixes issue 750)#764
ed-scherer wants to merge 4 commits intomicrosoft:mainfrom
protizmo:fix/750-folder-hash-preview

Conversation

@ed-scherer
Copy link

Previewing files that had names or paths containing "#" and other URI-invalid characters resulted in "File Not Found" errors in the preview browser window. This was due to improper URI component encoding (using encodeURI/decodeURI instead of encodeURIComponent/decodeURIComponent, along with also other problems with not respecting the current format of paths (file system paths vs. URIs).

Summary of changes:

  • Improve path encoding/decoding in pathUtil.ts
  • Update previewManager.ts to properly handle folders with special chars
  • Fix double-encoding problem in pageHistoryTracker.ts (would cause "back" to fail to return to files with special chars in path)
  • Add test directory and file with special characters ('#', ' ') in names
  • Update tests to verify special character handling in paths

The bulk of the changes are related to tests; the changes to fix the problems are quite minimal.

fixes microsoft#750)

- Improve path encoding/decoding in pathUtil.ts
- Update previewManager to properly handle folders with special chars
- Add test directory and file with special characters ('#', ' ') in names
- Update tests to verify special character handling in paths
…#750)

Handles URL component escaping for case when previewing loose file (outside of workspace).
- Update preview manager to handle folder hash scenarios (leading slash)
- Fix test configuration and runner setup
- Update connection info, endpoint manager, and preview tests
- Improve test coverage for folder-based previews

Fixes microsoft#750
microsoft#750)

The address passed to addHistory() is already URL-encoded from
window.location.pathname, so PathUtil.EscapePathParts() was causing
double-encoding and breaking back/forward navigation for files with
spaces or hash symbols in their names.
@ed-scherer
Copy link
Author

@microsoft-github-policy-service agree

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.

1 participant