mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-29 06:35:24 +00:00
fix: validate terminal link URLs before opening in external browser
This commit is contained in:
1 parent
ec87f8a4d1
commit
dcc75c980b
2 files changed
+14
-2
No files matched your search
+8
-1
@@ -953,7 +953,14 @@ function createWindow() {
|
||||
});
|
||||
|
||||
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
||||
shell.openExternal(url);
|
||||
try {
|
||||
const parsed = new URL(url);
|
||||
if (parsed.protocol === "http:" || parsed.protocol === "https:") {
|
||||
shell.openExternal(url);
|
||||
}
|
||||
} catch {
|
||||
// invalid URL, ignore
|
||||
}
|
||||
return { action: "deny" };
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user