mirror of
https://github.com/harness/drone.git
synced 2025-05-04 17:11:31 +08:00
[code-1822-maint] add validation method to git archive params (#2016)
This commit is contained in:
parent
723377482c
commit
fb5e38dd2c
13
git/repo.go
13
git/repo.go
@ -542,8 +542,19 @@ type ArchiveParams struct {
|
|||||||
api.ArchiveParams
|
api.ArchiveParams
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *ArchiveParams) Validate() error {
|
||||||
|
if err := p.ReadParams.Validate(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := p.ArchiveParams.Validate(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Service) Archive(ctx context.Context, params ArchiveParams, w io.Writer) error {
|
func (s *Service) Archive(ctx context.Context, params ArchiveParams, w io.Writer) error {
|
||||||
if err := params.ReadParams.Validate(); err != nil {
|
if err := params.Validate(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
repoPath := getFullPathForRepo(s.reposRoot, params.RepoUID)
|
repoPath := getFullPathForRepo(s.reposRoot, params.RepoUID)
|
||||||
|
Loading…
Reference in New Issue
Block a user