Skip to content

Commit ca9e71a

Browse files
author
matt
committed
fix(desktop): reject blank shared-history urls
1 parent 5fe7039 commit ca9e71a

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

‎apps/desktop/src/remoteConnection.test.ts‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,14 @@ describe("resolveDesktopRemoteConnection", () => {
122122
}),
123123
).toBeNull();
124124
});
125+
126+
it("throws for blank remote URLs in remote mode", () => {
127+
expect(() =>
128+
resolveDesktopRemoteConnection({
129+
mode: "remote",
130+
remoteUrl: " ",
131+
authToken: "secret-token",
132+
}),
133+
).toThrowError(DesktopRemoteConnectionConfigError);
134+
});
125135
});

‎apps/desktop/src/remoteConnection.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ export function resolveDesktopRemoteConnection(
5959

6060
const remoteUrlValue = sanitizeEnvValue(settings.remoteUrl);
6161
if (!remoteUrlValue) {
62-
return null;
62+
throw new DesktopRemoteConnectionConfigError(
63+
"Remote mode requires a remote URL. Use a full URL such as https://host:3773 or wss://host:3773.",
64+
);
6365
}
6466

6567
let parsedRemoteUrl: URL;

0 commit comments

Comments
 (0)