mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-19 12:54:24 +02: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
|
||||
}
|
||||
|
||||
func NewClient(cfg config.GiteaConfig, respCache cache.ICache) (*Client, error) {
|
||||
rootURL, err := url.Parse(cfg.Root)
|
||||
func NewClient(cfg config.ForgeConfig, respCache cache.ICache) (*Client, error) {
|
||||
// url.Parse returns valid on almost anything...
|
||||
rootURL, err := url.ParseRequestURI(cfg.Root)
|
||||
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}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue