Repository navigation
Don't flag an empty name field as an error - #30
Merged
Merged
Conversation
update_basename_validation runs on every text change, including the programmatic clears that happen when a New Folder/File prompt opens, cancels, or succeeds after creating. Since validate_basename treats an empty name as invalid, any of those routine clears could leave the field styled red before the user typed anything wrong (or anything at all). Treat an empty field as the normal, unstyled starting state instead: submission is still blocked (the function still returns false), only the alarming red border for a field nobody has touched yet is gone.
mrocha-montes
pushed a commit
to mrocha-montes/strata
that referenced
this pull request
Aug 31, 2026
Fallout from rebasing onto v0.4.0, which merged lgse#4 and renamed the shared new-folder state to the generalized new-entry state used by both New Folder and New File: - The focus-steal fix now checks active_new_entry instead of the since-renamed active_new_folder. - create_file() gets the same explicit refresh-after-create treatment as create_directory() for locations with no live monitor. - update_basename_validation's empty-field logic is now a separate pure basename_field_error() helper, so it can be unit tested without a real GTK widget. The previous version called gtk::init() directly, which works locally but fails on GitHub's headless CI runners (confirmed failing on PR lgse#30 for the same reason).
The previous test called gtk::init() to construct a real gtk::Entry,
which works on a machine with a display but fails on GitHub's headless
CI runners ("Failed to initialize GTK"), as confirmed by this PR's own
failing check. Extracted the empty-vs-invalid decision into a small
basename_field_error() helper with no GTK dependency, tested directly.
update_basename_validation's behavior is unchanged.
Contributor
|
Thank you for the fix @mrocha-montes, validated. I removed Claude's comments and merging now! |
l0gicgate
added a commit
that referenced
this pull request
Aug 31, 2026
* Accept typed URI locations and Windows-style SMB paths in the location bar navigate_input previously only recognized the literal "trash:///" as a URI and treated everything else as a native path, so typing any other scheme (smb://, sftp://, network:///) was rejected as "not an absolute path" before it ever reached the file source. This generalizes URI detection to any well-formed scheme, and additionally normalizes Windows-style UNC/SMB shorthand (\\host\share, smb:\\host\share) into a proper smb:// URI, matching how users are used to typing network paths. * Auto-mount unmounted network locations before failing navigation Typing or opening an smb:// (or other GVfs) location that isn't mounted yet used to surface a raw "location is not mounted" error with no way to proceed. LocationValidationError::NotMounted now carries the location so the UI can respond to it specifically: both the location-bar entry and column drill-down trigger gio::File::mount_enclosing_volume via a GTK MountOperation (which handles any credential prompt natively) and retry the original navigation on success. Also accept a bare "//host/share" network shorthand alongside the existing "\\host\share" UNC form, without touching ordinary single-slash absolute paths. * Recognize GVfs Mountable entries and mount them with the right GIO call GVfs reports an unmounted browsable child (an smb:// host's individual shares, a "Connect to Server" bookmark, ...) as FileType::Mountable rather than Directory, and querying that location's own info succeeds with that type instead of raising NOT_MOUNTED. Two things followed from that: - Entries of that type were previously classified as EntryKind::Other, so activating one asked the desktop to open it in a new application instead of descending into it - which, since Strata is the default file manager, spawned a second Strata window per click. - Mounting such a location needs gio::File::mount_mountable, not mount_enclosing_volume (which is for a file that merely sits on an unmounted volume). LocationValidationError gains a distinct Mountable(Location) case so the UI can pick the right GIO call. * Reject UNC and SCP shorthand instead of guessing an smb:// URI #20 explicitly scopes remote locations to proper URIs (smb://, sftp://, ftp://, dav://, ...) and calls out \\host\share and user@host:path as unsupported shorthand needing a clear message rather than silent reinterpretation. Drop the smb:// rewriting we added earlier and report LocationValidationError::UnsupportedShorthand for those forms instead, while leaving well-formed URIs untouched. * Close #20 gaps: cancel handling, embedded credentials, missing backends Address three gaps identified against #20's acceptance criteria before proposing this as SMB support: - Cancelling the GTK credential prompt (or a backend that already reported the failure itself) now returns quietly to the prior state instead of surfacing an alarming "Unable to connect" message. - A URI typed with an embedded password (smb://user:pass@host/share) is rejected outright with a safe explanation; a bare username (smb://user@host/share) is still accepted and prompts normally. - A missing GVfs backend (NOT_SUPPORTED) now names the scheme and, for SMB, the gvfs-smb package to install, instead of a raw GIO error. Also stopped logging the full URI (host/share/path) for remote locations, logging only the scheme. Manually verified all three against a live credential prompt. * Add a Network sidebar entry backed by GVfs network discovery Points at network:/// so the existing GIO-generic FileSource pipeline (already used for Trash and mounted volumes) browses locally discovered network hosts, mirroring Windows Explorer's Network folder. Discovery itself is handled entirely by gvfsd-network; this only wires up the sidebar entry and a bundled Lucide "network" icon. * Keep GVfs mounts URI-native instead of leaking their FUSE path A mounted GVfs backend (SMB, ...) can still return a `.path()` via its FUSE mirror even though the file isn't native, so the existing `.path().map(Location::local).unwrap_or_else(uri)` pattern picked the opaque `/run/user/$UID/gvfs/...` mirror over the clean URI everywhere a Location was derived from a gio::File: the DEVICES sidebar list, volume rows, click-to-navigate, and every child entry produced while enumerating a remote directory. Gate on `gio::File::is_native()` instead, in a single shared `location_for_file` helper (now `pub(crate)` from adapters) reused by the sidebar code that previously duplicated the same broken pattern. Closes #5 and the matching #20 acceptance criterion ("no /run/user/$UID/gvfs/... path exposed"). Manually verified: browsing Network -> a real SMB share -> a subfolder no longer fails with "That location does not exist". * Don't flag an empty name field as an error update_basename_validation runs on every text change, including the programmatic clears that happen when a New Folder/File prompt opens, cancels, or succeeds after creating. Since validate_basename treats an empty name as invalid, any of those routine clears could leave the field styled red before the user typed anything wrong (or anything at all) — found while creating a folder on a mounted SMB share, but the bug is unrelated to location and reproduces for local folders too. Treat an empty field as the normal, unstyled starting state instead: submission is still blocked (the function still returns false), only the alarming red border for a field nobody has touched yet is gone. * Don't let background selection refreshes steal focus from an inline edit Every directory batch delivered to a column that already has a selection re-fires SelectionSetChanged, and both that handler and FocusChanged unconditionally called column.list.grab_focus(). Slow network directories stream many batches over several seconds, so opening New Folder/File or a rename and starting to type would get its keyboard focus ripped back to the file list mid-batch, making the field look unresponsive (a blinking cursor stays visible for a moment due to redraw lag, but keystrokes go to the list's own type-ahead search instead). Local directories return everything in one fast batch, so the race window never showed up there. Skip the scroll-to-focus and grab_focus calls while a rename or new entry prompt is active for the view. * Refresh the open column after creating on a location with no monitor FileSource::watch only supports native paths, so a remote directory has no live monitor and its column never learns about a newly created item on its own. The operation itself succeeds (confirmed against a real SMB share, and visible in Nautilus), but the new folder stayed invisible in Strata until navigating away and back. operation_callback now takes the operation's parent/destination location and, when it lacks a native path, explicitly refreshes every open column at that location after a Created or Pasted event. Local directories already have a working watcher, so they're left alone to avoid a redundant reload. * Adapt to v0.4.0's generalized New File/Folder prompt Fallout from rebasing onto v0.4.0, which merged #4 and renamed the shared new-folder state to the generalized new-entry state used by both New Folder and New File: - The focus-steal fix now checks active_new_entry instead of the since-renamed active_new_folder. - create_file() gets the same explicit refresh-after-create treatment as create_directory() for locations with no live monitor. - update_basename_validation's empty-field logic is now a separate pure basename_field_error() helper, so it can be unit tested without a real GTK widget. The previous version called gtk::init() directly, which works locally but fails on GitHub's headless CI runners (confirmed failing on PR #30 for the same reason). * Explain when a location doesn't support Trash Moving an item to Trash on a backend without trash support (most remote filesystems, including SMB) fails with NOT_SUPPORTED, which previously surfaced as a raw GIO error. Detect that specific case and suggest permanent deletion instead. Per #20's own guidance, pre-emptively hiding the Trash option based on a capability query is a bigger, separate piece of work (its own delivery slice); this only improves what happens when the attempt is already made. * feat(smb): refine authentication and mount controls * fix(smb): harden remote navigation and refresh * fix(smb): cap automatic mount retries after authentication failure Without a limit, a mount that keeps failing before the credential prompt is ever answered (observed live against a real SMB share, where the operation resolved in well under 250ms with no button click or reply) retried forever, tearing down and rebuilding the authentication dialog on every failure and making it impossible to type into. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FM7CdkaaMoyPTGxaSFaF2M * Fix formatting (cargo fmt) in the previous commit Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FM7CdkaaMoyPTGxaSFaF2M * fix(smb): retry only rejected credential submissions * fix(smb): prompt after early authentication failure --------- Co-authored-by: Marcelo Rocha <[email protected]> Co-authored-by: Pierre Berube <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]>
spandan11106
pushed a commit
to spandan11106/strata
that referenced
this pull request
Sep 1, 2026
* Don't flag an empty name field as an error
update_basename_validation runs on every text change, including the
programmatic clears that happen when a New Folder/File prompt opens,
cancels, or succeeds after creating. Since validate_basename treats
an empty name as invalid, any of those routine clears could leave the
field styled red before the user typed anything wrong (or anything at
all).
Treat an empty field as the normal, unstyled starting state instead:
submission is still blocked (the function still returns false), only
the alarming red border for a field nobody has touched yet is gone.
* Test the pure validation logic instead of a live GTK widget
The previous test called gtk::init() to construct a real gtk::Entry,
which works on a machine with a display but fails on GitHub's headless
CI runners ("Failed to initialize GTK"), as confirmed by this PR's own
failing check. Extracted the empty-vs-invalid decision into a small
basename_field_error() helper with no GTK dependency, tested directly.
update_basename_validation's behavior is unchanged.
* chore: remove redundant comments
---------
Co-authored-by: Marcelo Rocha <[email protected]>
Co-authored-by: Pierre Berube <[email protected]>
spandan11106
pushed a commit
to spandan11106/strata
that referenced
this pull request
Sep 1, 2026
* Accept typed URI locations and Windows-style SMB paths in the location bar navigate_input previously only recognized the literal "trash:///" as a URI and treated everything else as a native path, so typing any other scheme (smb://, sftp://, network:///) was rejected as "not an absolute path" before it ever reached the file source. This generalizes URI detection to any well-formed scheme, and additionally normalizes Windows-style UNC/SMB shorthand (\\host\share, smb:\\host\share) into a proper smb:// URI, matching how users are used to typing network paths. * Auto-mount unmounted network locations before failing navigation Typing or opening an smb:// (or other GVfs) location that isn't mounted yet used to surface a raw "location is not mounted" error with no way to proceed. LocationValidationError::NotMounted now carries the location so the UI can respond to it specifically: both the location-bar entry and column drill-down trigger gio::File::mount_enclosing_volume via a GTK MountOperation (which handles any credential prompt natively) and retry the original navigation on success. Also accept a bare "//host/share" network shorthand alongside the existing "\\host\share" UNC form, without touching ordinary single-slash absolute paths. * Recognize GVfs Mountable entries and mount them with the right GIO call GVfs reports an unmounted browsable child (an smb:// host's individual shares, a "Connect to Server" bookmark, ...) as FileType::Mountable rather than Directory, and querying that location's own info succeeds with that type instead of raising NOT_MOUNTED. Two things followed from that: - Entries of that type were previously classified as EntryKind::Other, so activating one asked the desktop to open it in a new application instead of descending into it - which, since Strata is the default file manager, spawned a second Strata window per click. - Mounting such a location needs gio::File::mount_mountable, not mount_enclosing_volume (which is for a file that merely sits on an unmounted volume). LocationValidationError gains a distinct Mountable(Location) case so the UI can pick the right GIO call. * Reject UNC and SCP shorthand instead of guessing an smb:// URI lgse#20 explicitly scopes remote locations to proper URIs (smb://, sftp://, ftp://, dav://, ...) and calls out \\host\share and user@host:path as unsupported shorthand needing a clear message rather than silent reinterpretation. Drop the smb:// rewriting we added earlier and report LocationValidationError::UnsupportedShorthand for those forms instead, while leaving well-formed URIs untouched. * Close lgse#20 gaps: cancel handling, embedded credentials, missing backends Address three gaps identified against lgse#20's acceptance criteria before proposing this as SMB support: - Cancelling the GTK credential prompt (or a backend that already reported the failure itself) now returns quietly to the prior state instead of surfacing an alarming "Unable to connect" message. - A URI typed with an embedded password (smb://user:pass@host/share) is rejected outright with a safe explanation; a bare username (smb://user@host/share) is still accepted and prompts normally. - A missing GVfs backend (NOT_SUPPORTED) now names the scheme and, for SMB, the gvfs-smb package to install, instead of a raw GIO error. Also stopped logging the full URI (host/share/path) for remote locations, logging only the scheme. Manually verified all three against a live credential prompt. * Add a Network sidebar entry backed by GVfs network discovery Points at network:/// so the existing GIO-generic FileSource pipeline (already used for Trash and mounted volumes) browses locally discovered network hosts, mirroring Windows Explorer's Network folder. Discovery itself is handled entirely by gvfsd-network; this only wires up the sidebar entry and a bundled Lucide "network" icon. * Keep GVfs mounts URI-native instead of leaking their FUSE path A mounted GVfs backend (SMB, ...) can still return a `.path()` via its FUSE mirror even though the file isn't native, so the existing `.path().map(Location::local).unwrap_or_else(uri)` pattern picked the opaque `/run/user/$UID/gvfs/...` mirror over the clean URI everywhere a Location was derived from a gio::File: the DEVICES sidebar list, volume rows, click-to-navigate, and every child entry produced while enumerating a remote directory. Gate on `gio::File::is_native()` instead, in a single shared `location_for_file` helper (now `pub(crate)` from adapters) reused by the sidebar code that previously duplicated the same broken pattern. Closes lgse#5 and the matching lgse#20 acceptance criterion ("no /run/user/$UID/gvfs/... path exposed"). Manually verified: browsing Network -> a real SMB share -> a subfolder no longer fails with "That location does not exist". * Don't flag an empty name field as an error update_basename_validation runs on every text change, including the programmatic clears that happen when a New Folder/File prompt opens, cancels, or succeeds after creating. Since validate_basename treats an empty name as invalid, any of those routine clears could leave the field styled red before the user typed anything wrong (or anything at all) — found while creating a folder on a mounted SMB share, but the bug is unrelated to location and reproduces for local folders too. Treat an empty field as the normal, unstyled starting state instead: submission is still blocked (the function still returns false), only the alarming red border for a field nobody has touched yet is gone. * Don't let background selection refreshes steal focus from an inline edit Every directory batch delivered to a column that already has a selection re-fires SelectionSetChanged, and both that handler and FocusChanged unconditionally called column.list.grab_focus(). Slow network directories stream many batches over several seconds, so opening New Folder/File or a rename and starting to type would get its keyboard focus ripped back to the file list mid-batch, making the field look unresponsive (a blinking cursor stays visible for a moment due to redraw lag, but keystrokes go to the list's own type-ahead search instead). Local directories return everything in one fast batch, so the race window never showed up there. Skip the scroll-to-focus and grab_focus calls while a rename or new entry prompt is active for the view. * Refresh the open column after creating on a location with no monitor FileSource::watch only supports native paths, so a remote directory has no live monitor and its column never learns about a newly created item on its own. The operation itself succeeds (confirmed against a real SMB share, and visible in Nautilus), but the new folder stayed invisible in Strata until navigating away and back. operation_callback now takes the operation's parent/destination location and, when it lacks a native path, explicitly refreshes every open column at that location after a Created or Pasted event. Local directories already have a working watcher, so they're left alone to avoid a redundant reload. * Adapt to v0.4.0's generalized New File/Folder prompt Fallout from rebasing onto v0.4.0, which merged lgse#4 and renamed the shared new-folder state to the generalized new-entry state used by both New Folder and New File: - The focus-steal fix now checks active_new_entry instead of the since-renamed active_new_folder. - create_file() gets the same explicit refresh-after-create treatment as create_directory() for locations with no live monitor. - update_basename_validation's empty-field logic is now a separate pure basename_field_error() helper, so it can be unit tested without a real GTK widget. The previous version called gtk::init() directly, which works locally but fails on GitHub's headless CI runners (confirmed failing on PR lgse#30 for the same reason). * Explain when a location doesn't support Trash Moving an item to Trash on a backend without trash support (most remote filesystems, including SMB) fails with NOT_SUPPORTED, which previously surfaced as a raw GIO error. Detect that specific case and suggest permanent deletion instead. Per lgse#20's own guidance, pre-emptively hiding the Trash option based on a capability query is a bigger, separate piece of work (its own delivery slice); this only improves what happens when the attempt is already made. * feat(smb): refine authentication and mount controls * fix(smb): harden remote navigation and refresh * fix(smb): cap automatic mount retries after authentication failure Without a limit, a mount that keeps failing before the credential prompt is ever answered (observed live against a real SMB share, where the operation resolved in well under 250ms with no button click or reply) retried forever, tearing down and rebuilding the authentication dialog on every failure and making it impossible to type into. * Fix formatting (cargo fmt) in the previous commit * fix(smb): retry only rejected credential submissions * fix(smb): prompt after early authentication failure --------- Co-authored-by: Marcelo Rocha <[email protected]> Co-authored-by: Pierre Berube <[email protected]>
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.
Found this while testing something else, but it is not specific to that scenario, it reproduces for a plain local New Folder too.
The bug
update_basename_validationruns on every text change, including the programmatic clears that happen when a New Folder/File prompt opens, cancels, or succeeds after creating. Sincevalidate_basename("")treats an empty name as invalid, any of those routine clears can leave the field styled red before the user has typed anything wrong, or anything at all.Repro:
/), press Enter. It gets rejected in place, no dialog, field turns red. So far expected.Confirmed present on the current
main(v0.4.0).The fix
Treat an empty field as the normal, unstyled starting state rather than an error state. Submission is still blocked (the function still returns
falsefor an empty name), only the alarming red border for a field nobody has touched yet is gone.Added a unit test constructing a real
gtk::Entryand drivingupdate_basename_validationdirectly,check.shpasses (142 tests).