mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-05 06:12:02 +08:00
Correctly compute 'startURL' when using a frontend development server. (#3299)
* Fix computing 'startURL' when 'FRONTEND_DEVSERVER_URL' is present. * Respect provided URL when computing 'startURL' and 'FRONTEND_DEVSERVER_URL' is present. * Update changelog. * Correctly produce absolute URI in 'GetStartURL' when input is provided.
This commit is contained in:
parent
4467a1ffa2
commit
f38532bcf5
@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Fix failing Windows build due to unknown option by [thomas-senechal](https://github.com/thomas-senechal) in PR [#3208](https://github.com/wailsapp/wails/pull/3208)
|
- Fix failing Windows build due to unknown option by [thomas-senechal](https://github.com/thomas-senechal) in PR [#3208](https://github.com/wailsapp/wails/pull/3208)
|
||||||
- Fix wrong baseURL when open window twice by @5aaee9 in PR [#3273](https://github.com/wailsapp/wails/pull/3273)
|
- Fix wrong baseURL when open window twice by @5aaee9 in PR [#3273](https://github.com/wailsapp/wails/pull/3273)
|
||||||
- Fix ordering of if branches in `WebviewWindow.Restore` method by [@fbbdev](https://github.com/fbbdev) in [#3279](https://github.com/wailsapp/wails/pull/3279)
|
- Fix ordering of if branches in `WebviewWindow.Restore` method by [@fbbdev](https://github.com/fbbdev) in [#3279](https://github.com/wailsapp/wails/pull/3279)
|
||||||
|
- Correctly compute `startURL` across multiple `GetStartURL` invocations when `FRONTEND_DEVSERVER_URL` is present. [#3299](https://github.com/wailsapp/wails/pull/3299)
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -148,26 +148,19 @@ func GetStartURL(userURL string) (string, error) {
|
|||||||
}
|
}
|
||||||
port := parsedURL.Port()
|
port := parsedURL.Port()
|
||||||
if port != "" {
|
if port != "" {
|
||||||
baseURL.Host = net.JoinHostPort(baseURL.Host, port)
|
baseURL.Host = net.JoinHostPort(baseURL.Hostname(), port)
|
||||||
startURL = baseURL.String()
|
startURL = baseURL.String()
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
|
||||||
if userURL != "" {
|
if userURL != "" {
|
||||||
// parse the url
|
parsedURL, err := baseURL.Parse(userURL)
|
||||||
parsedURL, err := url.Parse(userURL)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("Error parsing URL: " + err.Error())
|
return "", fmt.Errorf("Error parsing URL: " + err.Error())
|
||||||
}
|
}
|
||||||
if parsedURL.Scheme == "" {
|
|
||||||
startURL = baseURL.ResolveReference(&url.URL{Path: userURL}).String()
|
startURL = parsedURL.String()
|
||||||
// if the original URL had a trailing slash, add it back
|
|
||||||
if strings.HasSuffix(userURL, "/") && !strings.HasSuffix(startURL, "/") {
|
|
||||||
startURL = startURL + "/"
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
startURL = userURL
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return startURL, nil
|
return startURL, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user