GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(web): don't label Windows paths outside the workspace as relative… · Pipyakas/t3code@7ae21bf

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/web/src
    • filePathDisplay.test.ts
    • filePathDisplay.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/web/src/filePathDisplay.test.ts‎

Copy file name to clipboard
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { describe, expect, it } from "vite-plus/test";
2+
3+
import { formatWorkspaceRelativePath } from "./filePathDisplay";
4+
5+
describe("formatWorkspaceRelativePath", () => {
6+
it("labels only relative paths, not Windows paths outside the workspace", () => {
7+
const workspaceRoot = "C:\\Users\\mike\\dev-stuff\\t3code";
8+
expect(
9+
formatWorkspaceRelativePath("C:\\Users\\mike\\.claude\\settings.json:3", workspaceRoot),
10+
).toBe("C:/Users/mike/.claude/settings.json:3");
11+
expect(formatWorkspaceRelativePath("D:/data/report.csv", workspaceRoot)).toBe(
12+
"D:/data/report.csv",
13+
);
14+
expect(formatWorkspaceRelativePath("src/app.ts", workspaceRoot)).toBe("t3code/src/app.ts");
15+
});
16+
});
Collapse file

‎apps/web/src/filePathDisplay.ts‎

Copy file name to clipboardExpand all lines: apps/web/src/filePathDisplay.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function formatWorkspaceRelativePath(
4646
} else if (pathForCompare.startsWith(workspaceWithSeparator)) {
4747
const relativeSuffix = normalizedPath.slice(normalizedWorkspaceRoot.length + 1);
4848
displayPath = `${workspaceLabel}/${relativeSuffix}`;
49-
} else if (!normalizedPath.startsWith("/")) {
49+
} else if (!normalizedPath.startsWith("/") && !isWindowsAbsolutePath(normalizedPath)) {
5050
const relativePath = stripRelativePrefixes(normalizedPath);
5151
displayPath = pathForCompare.startsWith(workspaceLabelWithSeparator)
5252
? normalizedPath

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.