mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 13:56:57 +00:00
better error message when using wrong forge-root-url
This commit is contained in:
parent
b54cd38d0b
commit
9ce901bfa0
1 changed files with 5 additions and 4 deletions
|
@ -57,12 +57,13 @@ type Client struct {
|
||||||
defaultMimeType string
|
defaultMimeType string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(cfg config.GiteaConfig, respCache cache.ICache) (*Client, error) {
|
func NewClient(cfg config.ForgeConfig, respCache cache.ICache) (*Client, error) {
|
||||||
rootURL, err := url.Parse(cfg.Root)
|
// url.Parse returns valid on almost anything...
|
||||||
|
rootURL, err := url.ParseRequestURI(cfg.Root)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("invalid forgejo/gitea root url: %w", err)
|
||||||
}
|
}
|
||||||
giteaRoot := strings.Trim(rootURL.String(), "/")
|
giteaRoot := strings.TrimSuffix(rootURL.String(), "/")
|
||||||
|
|
||||||
stdClient := http.Client{Timeout: 10 * time.Second}
|
stdClient := http.Client{Timeout: 10 * time.Second}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue