diff --git a/packages/workspace-server/src/services/os/os.test.ts b/packages/workspace-server/src/services/os/os.test.ts index aaa9511312..dc0b0ce676 100644 --- a/packages/workspace-server/src/services/os/os.test.ts +++ b/packages/workspace-server/src/services/os/os.test.ts @@ -159,6 +159,14 @@ describe("OsService simple delegations", () => { await service.openExternal("https://posthog.com"); expect(urlLauncher.launch).toHaveBeenCalledWith("https://posthog.com"); }); + + it("opens the log folder as a file URL via the url launcher", async () => { + const { service, urlLauncher } = createService(); + await service.showLogFolder(); + expect(urlLauncher.launch).toHaveBeenCalledWith( + expect.stringMatching(/^file:\/\//), + ); + }); }); describe("OsService.getClaudePermissions", () => { diff --git a/packages/workspace-server/src/services/os/os.ts b/packages/workspace-server/src/services/os/os.ts index ea0f56ec30..08a3b1d065 100644 --- a/packages/workspace-server/src/services/os/os.ts +++ b/packages/workspace-server/src/services/os/os.ts @@ -1,6 +1,7 @@ import fs from "node:fs"; import os from "node:os"; import path from "node:path"; +import { pathToFileURL } from "node:url"; import { APP_META_SERVICE, type IAppMeta } from "@posthog/platform/app-meta"; import { DIALOG_SERVICE, @@ -169,7 +170,9 @@ export class OsService { } async showLogFolder(): Promise { - await this.urlLauncher.launch(`file://${this.storagePaths.logFolderPath}`); + await this.urlLauncher.launch( + pathToFileURL(this.storagePaths.logFolderPath).href, + ); } async searchDirectories(query: string): Promise {