mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-22 08:27:06 +00:00
Use path.Join for server side path generation (#2689)
make sure to have valid config even when server is running under windows --- *Sponsored by Kithara Software GmbH*
This commit is contained in:
parent
fe7dc3fff5
commit
e83357833d
2 changed files with 6 additions and 7 deletions
|
@ -18,7 +18,6 @@ import (
|
|||
"fmt"
|
||||
"maps"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/google/uuid"
|
||||
|
@ -212,8 +211,8 @@ func (c *Compiler) createProcess(name string, container *yaml_types.Container, s
|
|||
}
|
||||
|
||||
func (c *Compiler) stepWorkdir(container *yaml_types.Container) string {
|
||||
if filepath.IsAbs(container.Directory) {
|
||||
if path.IsAbs(container.Directory) {
|
||||
return container.Directory
|
||||
}
|
||||
return filepath.Join(c.base, c.path, container.Directory)
|
||||
return path.Join(c.base, c.path, container.Directory)
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ package compiler
|
|||
|
||||
import (
|
||||
"net/url"
|
||||
"path/filepath"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/woodpecker-ci/woodpecker/pipeline/frontend/metadata"
|
||||
|
@ -105,12 +105,12 @@ func WithWorkspace(base, path string) Option {
|
|||
// WithWorkspaceFromURL configures the compiler with the workspace
|
||||
// base and path based on the repository url.
|
||||
func WithWorkspaceFromURL(base, link string) Option {
|
||||
path := "src"
|
||||
srcPath := "src"
|
||||
parsed, err := url.Parse(link)
|
||||
if err == nil {
|
||||
path = filepath.Join(path, parsed.Hostname(), parsed.Path)
|
||||
srcPath = path.Join(srcPath, parsed.Hostname(), parsed.Path)
|
||||
}
|
||||
return WithWorkspace(base, path)
|
||||
return WithWorkspace(base, srcPath)
|
||||
}
|
||||
|
||||
// WithEscalated configures the compiler to automatically execute
|
||||
|
|
Loading…
Reference in a new issue