@devries-cameron20 / t3code-1 / commits / 19c9df2161
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(web): diff Copy path uses Windows separators in a Windows workspace (#30394)

Co-authored-by: maria-rcks <maria@kuuro.net> Co-authored-by: Julius Marminge <julius0216@outlook.com>

spoukyii committed Nov 14, 2026 at 15:17 UTC 19c9df216129f96719f0b58c8068303b498e1dc0
3 files changed +29 -4
apps/web/src/components/DiffFilePathCopyButton.browser.test.tsx
+14 -1
@@ -8,7 +8,7 @@ import { AnchoredToastProvider } from "./ui/toast";
8 it("explains a denied clipboard write and lets the same path be copied again", async () => {
9 await using screen = await render(
10 <AnchoredToastProvider timeout={0}>
11 - <DiffFilePathCopyButton filePath="apps/web/src/index.ts" />
11 + <DiffFilePathCopyButton filePath="apps/web/src/index.ts" workspaceRoot="/repo" />
12 </AnchoredToastProvider>,
13 );
14 using write = vi
@@ -28,3 +28,16 @@ it("explains a denied clipboard write and lets the same path be copied again", a
28 expect(write).toHaveBeenCalledTimes(2);
29 expect(write).toHaveBeenLastCalledWith("apps/web/src/index.ts");
30 });
31 +
32 +it("copies a Windows workspace's file path with Windows separators", async () => {
33 + await using screen = await render(
34 + <AnchoredToastProvider timeout={0}>
35 + <DiffFilePathCopyButton filePath="apps/web/src/index.ts" workspaceRoot="C:\repo" />
36 + </AnchoredToastProvider>,
37 + );
38 + using write = vi.spyOn(navigator.clipboard, "writeText").mockResolvedValue(undefined);
39 +
40 + await screen.getByRole("button", { name: "Copy file path" }).click();
41 +
42 + await vi.waitFor(() => expect(write).toHaveBeenCalledWith("apps\\web\\src\\index.ts"));
43 +});
apps/web/src/components/DiffFilePathCopyButton.tsx
+11 -2
@@ -1,3 +1,4 @@
1 +import { formatFilePathForClipboard } from "@t3tools/client-runtime/media-actions";
2 import { CheckIcon, CopyIcon } from "lucide-react";
3 import { useRef } from "react";
4 import { useCopyToClipboard } from "../hooks/useCopyToClipboard";
@@ -5,7 +6,13 @@ import { ANCHORED_COPY_TOAST_TIMEOUT_MS, showAnchoredCopyErrorToast } from "./ui
6 import { Button } from "./ui/button";
7 import { Tooltip, TooltipPopup, TooltipTrigger } from "./ui/tooltip";
8
8 -export function DiffFilePathCopyButton({ filePath }: { filePath: string }) {
9 +export function DiffFilePathCopyButton({
10 + filePath,
11 + workspaceRoot,
12 +}: {
13 + filePath: string;
14 + workspaceRoot: string | undefined;
15 +}) {
16 const ref = useRef<HTMLButtonElement>(null);
17 const { copyToClipboard, isCopied } = useCopyToClipboard<void>({
18 onError: (error) => showAnchoredCopyErrorToast(ref, error),
@@ -21,7 +28,9 @@ export function DiffFilePathCopyButton({ filePath }: { filePath: string }) {
28 size="icon-micro"
29 variant="ghost-muted"
30 aria-label="Copy file path"
24 - onClick={() => copyToClipboard(filePath, undefined)}
31 + onClick={() =>
32 + copyToClipboard(formatFilePathForClipboard(filePath, workspaceRoot), undefined)
33 + }
34 />
35 }
36 >
apps/web/src/components/DiffPanel.tsx
+4 -1
@@ -177,12 +177,14 @@ function DiffFileCollapseToggle({
177
178 function DiffFileHeaderSuffix({
179 filePath,
180 + workspaceRoot,
181 hasStat,
182 error,
183 truncated,
184 onRetry,
185 }: {
186 filePath: string;
187 + workspaceRoot: string | undefined;
188 hasStat: boolean;
189 error: boolean;
190 truncated: boolean;
@@ -191,7 +193,7 @@ function DiffFileHeaderSuffix({
193 return (
194 <>
195 <span data-diff-copy-path className="inline-flex">
194 - <DiffFilePathCopyButton filePath={filePath} />
196 + <DiffFilePathCopyButton filePath={filePath} workspaceRoot={workspaceRoot} />
197 </span>
198 {hasStat ? (
199 <DiffFileStatus error={error} truncated={truncated} retry={() => onRetry(filePath)} />
@@ -1436,6 +1438,7 @@ export default function DiffPanel({
1438 return (
1439 <DiffFileHeaderSuffix
1440 filePath={path}
1441 + workspaceRoot={activeCwd}
1442 hasStat={fileStats.has(path)}
1443 error={state?.error ?? false}
1444 truncated={state?.truncated ?? false}