nautilus: resolve GVFS/SMB paths correctly and show clean URIs - #14
Open
mward5 wants to merge 1 commit into
Open
nautilus: resolve GVFS/SMB paths correctly and show clean URIs#14mward5 wants to merge 1 commit into
mward5 wants to merge 1 commit into
Conversation
mward5
force-pushed
the
fix/nautilus-smb-context-menus
branch
from
August 18, 2026 22:06
6cd73be to
de9335d
Compare
nautilus_to_path() called g_filename_from_uri() directly on the file's URI, which only handles file:// schemes. For GVFS-backed locations (smb://, sftp://, etc.) it returned NULL, so "Select Left File/Folder for Compare" and "Compare to" silently failed for network shares. Resolve the location through its GFile instead, which for a GVFS mount with an active FUSE bridge yields the real /run/user/<uid>/gvfs/... path that both file_is_dir() and bcompare need. That path is correct but ugly to look at, so convert it back to the original URI at the one point where it matters: the argv handed to bcompare. path_to_display() maps a GVFS-backed path to its clean smb://server/share/... form and leaves local paths untouched, so Beyond Compare's address bar shows the network location the user actually browsed rather than the FUSE mount point. Keeping the conversion at the argv boundary means everything upstream of it -- the selection storage files, the menu-item data, and every file_is_dir() call including the delayed one that runs against a path round-tripped through LeftFileStorage on a later right-click -- keeps working with real, stat()-able paths exactly as before. Nothing else in the extension has to know about URIs, and the on-disk format of the selection files is unchanged. Thunar has the identical unfixed bug in bcompare-thunarx.c but is left untouched here, matching this fix's own verified/tested scope. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
mward5
force-pushed
the
fix/nautilus-smb-context-menus
branch
from
August 19, 2026 19:09
de9335d to
1332b00
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.
The bug
nautilus_to_path()calledg_filename_from_uri()directly on the file's URI. That function only understandsfile://and returnsNULLfor anything GVFS-backed, so onsmb://(andsftp://, etc.) shares "Select Left File/Folder for Compare" silently captured nothing and the follow-up "Compare to" never worked.The fix
Resolve the location through its
GFileinstead. For a GVFS mount with an active FUSE bridge this yields the real/run/user/<uid>/gvfs/...path that bothfile_is_dir()andbcompareneed.That path works but is unpleasant to look at in Beyond Compare's address bar, so it's converted back to the original URI at the single point where that matters — the
argvhanded tobcompare.path_to_display()maps a GVFS-backed path to its cleansmb://server/share/...form and leaves local paths untouched.Keeping the conversion at the
argvboundary means everything upstream of it — the selection storage files, the menu-item data, and everyfile_is_dir()call including the delayed one that runs against a path round-tripped throughLeftFileStorageon a later right-click — keeps working with real, stat()-able paths exactly as before. The on-disk format of the selection files is unchanged, andbeyondcompare_get_file_items(), theBCompareExtstruct, and all six*_mitem()builders are untouched.Scope
Nautilus only. Thunar has the identical bug in
bcompare-thunarx.c(thunarx_to_path()), but it's unverified here and belongs in its own change.On the approach
An earlier version of this fix carried two parallel values (real path + display URI) through the struct, the menu items, and a two-line selection-file format. It works, but it's ~3x the diff and changes the storage format. It's preserved at
alt/dual-value-carryfor comparison.Converting at the
argvboundary turned out to be much simpler, mainly because GIO already performs the FUSE-path to URI mapping natively viag_file_new_for_commandline_arg()+g_file_get_uri()— no parsing of GVFS's internal mount naming is required, including for filenames containing commas, which that naming scheme uses as its own separator.Testing
Verified against a live
smb://share, both the multi-select workflow and the two-step "Select Left..." then right-click "Compare to" workflow:smb://file vs.smb://filesmb://file vs. local file (cross-location, two-step)smb://folder compare — detected as a folder and shows the clean URImake -C nautilus ext64(only pre-existing GTK deprecation warnings)