mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 21:03:47 +00:00
Merge pull request #769 from ZacharyZcR/fix/electron-url-handler
fix: validate terminal link URLs before opening in external browser
This commit is contained in:
+8
-1
@@ -955,7 +955,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