mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
fix: clean template destination path for pull
(#12559)
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
|
||||
"github.com/codeclysm/extract/v3"
|
||||
@ -130,6 +131,13 @@ func (r *RootCmd) templatePull() *clibase.Cmd {
|
||||
dest = templateName
|
||||
}
|
||||
|
||||
clean, err := filepath.Abs(filepath.Clean(dest))
|
||||
if err != nil {
|
||||
return xerrors.Errorf("cleaning destination path %s failed: %w", dest, err)
|
||||
}
|
||||
|
||||
dest = clean
|
||||
|
||||
err = os.MkdirAll(dest, 0o750)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("mkdirall %q: %w", dest, err)
|
||||
|
Reference in New Issue
Block a user