Repository navigation
fix: accept a URI typed into the location bar from any location - #1984
Merged
Merged
Conversation
The location bar inherits its type from the tab's current location
(Message::EditLocationEnable), and the view has exactly two branches, next
to the existing "TODO: allow editing other locations": a Location::Network
is edited through with_uri, anything else through with_path. Typing
smb://server/share while standing in a local folder therefore produced
Path("smb://server/share"), which is not a directory, and the navigation
was dropped. The reverse direction was broken the same way: from the
Networks view a local path was passed to with_uri and became a bogus
network location.
EditLocationSubmit now decides by parsing the text instead of by the
location it came from:
* parses as a URL with a scheme other than "file" and has a host
-> Location::Network, using url::Url::as_str(), which also normalizes
away surrounding whitespace.
* fails to parse and the current location is a Network
-> Location::Path, with the text untrimmed, because a directory name
may legitimately end in a space.
* anything else is left as it was, so network:/// and foo:bar keep
behaving exactly as before.
The reliable indicator for "this is a path" is that parsing fails, not
that the host is missing: network:/// and file:///home both parse with
has_host() == false. Verified against url 2.5.8.
An unmounted share cannot be resolved, since Tab::resolve sends network
locations through mounter.dir_info, so resolve() returns None and the
navigation would be dropped again. Navigating there is what triggers the
mount, because Cmd::NetworkScan mounts the location it is asked to scan,
so the typed URI is used as a fallback. That fallback is restricted to
input recognised by the first rule above; applying it to any network
location would let unparseable text through, and because with_uri keeps
the display name and path of the previous location, the window would look
normal while the listing stayed empty.
Known cosmetic side effect: while the share is not mounted, resolve()
yields nothing and the tab shows the raw URI as its name. It is replaced
by the proper name as soon as the mount completes.
Drafted with AI assistance (Claude Code); the change was reviewed, built
and tested by me on real hardware as described.
Signed-off-by: chris-010 <10660568+chris-010@users.noreply.github.com>
jackpot51
approved these changes
Aug 18, 2026
jacobktm
approved these changes
Aug 18, 2026
jacobktm
left a comment
There was a problem hiding this comment.
This has passed regression testing.
# TestingThis document provides a regression testing checklist for COSMIC Files. The checklist provides a starting point for Quality Assurance reviews.
Checklist
Basic navigation
- Middle-click opens directory in a new tab (not focused).
- Open two scrollable tabs. Scroll one tab, then switch to the other tab; it should not have scrolled.
- Hover over the top item in the folder, then scroll down until it's out of view (while still hovered).
On scrolling back up (with the mouse in a different position), the item should not have the hover highlight. - Right-click an item in the sidebar. No visual change should occur with the rest of the items.
- Remove an item from the sidebar, then re-pin it.
File operations
- Right-click -> Create a new folder, then enter it.
- Right-click in the empty folder -> Create a new file.
- Navigate to the parent folder, create another new file, then drag it into the created folder.
- Files can be renamed.
- Files can be opened with non-default apps & browsing store for new apps works.
- Normal right-click shows
Move to trashoption. - Shift right-click, and right-click followed by Shift, both show
Permanently deleteoption.
Advanced navigation & view settings
- Image and video thumbnails generate & display in local folders.
- Gallery preview shows with Spacebar.
- Details pane shows with Ctrl+Spacebar.
- Zoom in/out and reset to default zoom work.
- Ctrl+1 and Ctrl+2 switch between list and icon view.
- Ctrl+H shows/hides hidden files.
- Directories can be sorted at top or inline.
- Settings -> Theme works.
- Settings -> Type to Search affects behavior as designed.
- Single-click to open setting takes effect.
- Sorting options work.
- Cutting, copying, and pasting files works.
- F5 reloads current directory.
- Left sidebar can be collapsed and expanded.
External filesystems
- Add a network drive (e.g. SFTP) and navigate into it.
- Plug in a USB drive; able to mount, browse, and eject.
Integrations
- Desktop icons display as expected
- Drag-and-drop into Firefox works
Browsing to network shares from the location bar also works.
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.
Typing
smb://server/shareinto the location bar only works while the tab is already on a network location. From a normal folder the text is turned into a path and the navigation is dropped:The bar inherits its type from the tab (
Message::EditLocationEnable), and the view only has the two branches next to the existing//TODO: allow editing other locations.EditLocationSubmitnow decides by parsing the input instead. The reverse direction — a local path typed while standing in Networks — was broken the same way.Known cosmetic side effect: while the share is not yet mounted the tab shows the raw URI as its name; the proper name appears once the mount completes.
Tested against a real SMB server on a build of
5bdfffacarrying only this patch, with an isolatedXDG_CONFIG_HOME. Across the whole run:failed to connect0,no path for item0,failed to scan0.Eight steps, and two notes that may save a reviewer time
smb://user@server/from a local folder/home/…/tmpfrom the network locationfoo:barfrom a local foldersmb://server/share, not mountedfoo:barfrom a mounted sharenetwork:///andfile:///homeboth parse withhas_host() == false. An earlier version keyed on the host and would have broken the Networks view.Tab::resolve→mounter.dir_info), so navigating needs a fallback to the typed URI — and navigating is what triggers the mount, sinceCmd::NetworkScanmounts the location it is asked to scan. The fallback is restricted to input recognised as a URI with a host; applying it to any network location let unparseable text through, and becausewith_urikeeps the previous display name and path, the window looked normal while the listing stayed empty.