Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/web/src/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2379,7 +2379,7 @@ function OpenCommandPaletteDialog(props: {
cloneDirectoryName: pinnedCloneDirectoryName,
caseSensitive: !isWindowsPlatform(browseEnvironmentPlatform),
})
: appendBrowsePathSegment(query, name);
: appendBrowsePathSegment(browsePath.directoryPath, name);
await browseNavigation.run(
() => prefetchBrowsePath(getBrowseDirectoryPath(nextQuery)),
() => {
Expand Down Expand Up @@ -2797,7 +2797,7 @@ function OpenCommandPaletteDialog(props: {
void browseTo(completion.name);
} else if (completion && !pinnedCloneDirectoryName) {
setHighlightedItemValue(null);
setQuery(`${getBrowseDirectoryPath(query)}${completion.name}`);
setQuery(`${browsePath.directoryPath}${completion.name}`);
}
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,9 @@ function AddTrackedFolderDialog(props: {
key={entry.fullPath}
type="button"
className={rowClassName}
onClick={() => setQuery(appendBrowsePathSegment(query, entry.name))}
onClick={() =>
setQuery(appendBrowsePathSegment(browsePath.directoryPath, entry.name))
}
>
<FolderIcon className="size-4 shrink-0 text-muted-foreground" />
<span className="min-w-0 truncate">{entry.name}</span>
Expand Down
7 changes: 7 additions & 0 deletions packages/client-runtime/src/state/filesystem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ describe("filesystem browse model", () => {
parentPath: "~/",
canBrowseUp: true,
});
expect(getFilesystemBrowsePath("D:", "Win32")).toEqual({
isBrowsing: true,
directoryPath: "D:\\",
filterQuery: "",
parentPath: null,
canBrowseUp: false,
});
expect(getFilesystemBrowsePath("C:\\Users\\test", "MacIntel").isBrowsing).toBe(false);
expect(getFilesystemBrowsePath("~/projects/", "", false).isBrowsing).toBe(false);
});
Expand Down
8 changes: 6 additions & 2 deletions packages/client-runtime/src/state/filesystem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,13 @@ export function resolveFilesystemReadAccess(

export function getFilesystemBrowsePath(query: string, platform = "", enabled = true) {
const isBrowsing = enabled && isFilesystemBrowseQuery(query, platform);
const directoryPath = isBrowsing ? getBrowseDirectoryPath(query) : "";
// A bare drive has no separator, so it would otherwise filter its own listing by "D:".
const browseQuery = /^[a-zA-Z]:$/.test(query) ? `${query}\\` : query;
const directoryPath = isBrowsing ? getBrowseDirectoryPath(browseQuery) : "";
const filterQuery =
isBrowsing && !hasTrailingPathSeparator(query) ? getBrowseLeafPathSegment(query) : "";
isBrowsing && !hasTrailingPathSeparator(browseQuery)
? getBrowseLeafPathSegment(browseQuery)
: "";
const parentPath = isBrowsing ? getBrowseParentPath(directoryPath) : null;

return {
Expand Down
Loading