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 — test(shared): cover one-letter schemes parsed as drives · AdEx-Partners-DE/t3code@10b97fe

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/shared/src
    • fileLinks.test.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/shared/src/fileLinks.test.ts‎

Copy file name to clipboardExpand all lines: packages/shared/src/fileLinks.test.ts
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,17 @@ describe("parseFileUrlHref", () => {
103103
it.each(["https://example.com/a.ts", "file://%", "/Users/julius/a.ts"])("rejects %s", (href) => {
104104
expect(parseFileUrlHref(href)).toBeNull();
105105
});
106+
107+
it("rejects one-letter schemes that Chromium on Windows reads as drive letters", () => {
108+
const NativeURL = URL;
109+
using _url = vi.spyOn(globalThis, "URL").mockImplementation(function (input: string | URL) {
110+
const drive = /^([a-z]):/i.exec(String(input));
111+
return drive
112+
? new NativeURL(`file:///${drive[1]!.toUpperCase()}:/${String(input).slice(2)}`)
113+
: new NativeURL(input);
114+
});
115+
expect(parseFileUrlHref("d:x")).toBeNull();
116+
});
106117
});
107118

108119
describe("splitFilePathPosition", () => {

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.