feat(app): add workspace file browser to session files screen#709
Open
seibe wants to merge 3 commits intoslopus:mainfrom
Open
feat(app): add workspace file browser to session files screen#709seibe wants to merge 3 commits intoslopus:mainfrom
seibe wants to merge 3 commits intoslopus:mainfrom
Conversation
Add directory-based file browsing mode alongside the existing git changes view. Users can now navigate all workspace files regardless of git status. Non-git workspaces default to browse mode instead of showing an error.
Replace btoa/atob with utf8ToBase64/base64ToUtf8 to prevent crashes on non-ASCII file paths (CJK, Cyrillic, emoji). Output is URL-safe (uses - and _ instead of + and /). Decoder includes legacy atob fallback for backward compatibility.
atob() only produces a binary string where each byte maps to one char, so multi-byte UTF-8 text (e.g. Japanese) was garbled. Use TextDecoder with fatal:true as the primary decoder and decodeURIComponent as fallback. Also switch binary detection from split/filter to a for-loop to avoid large intermediate allocations, handle empty files explicitly, and treat non-UTF-8 text as binary instead of showing mojibake.
4f430df to
66f7cb6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Extends the existing session Files screen from a git-changes-only view into a dual-mode screen with "Changes" and "Browse" tabs. Users can now navigate the full workspace directory tree, not just view staged/unstaged git changes.
Also fixes UTF-8 handling for both file paths and file content, which caused crashes and garbled text with non-ASCII filenames and multi-byte content (CJK, Cyrillic, emoji).
Related issues
atob()only supports Latin-1 and corrupts multi-byte UTF-8 sequences. This PR replacesatob()withTextDecoder('utf-8')for file content and adds URL-safe UTF-8 base64 encoding for file paths, fixing the exact issue reported.What's new
Browse mode
.prefixed) filtered outUTF-8 path encoding (fixes #199 partially)
btoa()/atob()with URL-safe UTF-8 base64 encoding/decoding (utf8ToBase64/base64ToUtf8instringUtils.ts)atob()fallback for paths encoded before this changeUTF-8 content decoding (fixes #199)
TextDecoder('utf-8', { fatal: true })instead of rawatob()binary stringsplit().filter())Changes by file
files.tsx: Add Browse mode with directory navigation, mode toggle UI, path bar, auto-switch for non-git workspacesfile.tsx: UTF-8 safe path decoding with legacy fallback; UTF-8 content decoding via TextDecoderstringUtils.ts: Newutf8ToBase64()andbase64ToUtf8()utilitiesbrowseTab,changesTab,directory,emptyDirectorykeysTest plan