mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 22:55:48 +01:00
* add url validation for BrowserOpenURL * update changelog * don't process invalid urls * address AI issues * added more validations and sanitization
23 lines
543 B
Go
23 lines
543 B
Go
//go:build linux
|
|
// +build linux
|
|
|
|
package linux
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/pkg/browser"
|
|
"github.com/wailsapp/wails/v2/internal/frontend/utils"
|
|
)
|
|
|
|
// BrowserOpenURL Use the default browser to open the url
|
|
func (f *Frontend) BrowserOpenURL(rawURL string) {
|
|
url, err := utils.ValidateAndSanitizeURL(rawURL)
|
|
if err != nil {
|
|
f.logger.Error(fmt.Sprintf("Invalid URL %s", err.Error()))
|
|
return
|
|
}
|
|
// Specific method implementation
|
|
if err := browser.OpenURL(url); err != nil {
|
|
f.logger.Error("Unable to open default system browser")
|
|
}
|
|
}
|