Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v2] Validate devServer property to be of the correct form #1359

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions v2/cmd/wails/internal/commands/dev/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
"net"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -125,6 +126,16 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
return err
}

devServer := flags.devServer
if _, _, err := net.SplitHostPort(devServer); err != nil {
return fmt.Errorf("DevServer is not of the form 'host:port', please check your wails.json")
}

devServerURL, err := url.Parse("http://" + devServer)
if err != nil {
return err
}

// Update go.mod to use current wails version
err = syncGoModVersion(cwd)
if err != nil {
Expand Down Expand Up @@ -175,11 +186,6 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
defer closer(&devCommandWaitGroup)
}

devServerURL, err := url.Parse("http://" + flags.devServer)
if err != nil {
return err
}

// open browser
if flags.openBrowser {
err = browser.OpenURL(devServerURL.String())
Expand Down