[code-1822-maint] add validation method to git archive params (#2016)

ritik/code-1773
Enver Biševac 2024-04-26 22:54:08 +00:00 committed by Harness
parent 723377482c
commit fb5e38dd2c
1 changed files with 12 additions and 1 deletions

View File

@ -542,8 +542,19 @@ type ArchiveParams struct {
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 {
if err := params.ReadParams.Validate(); err != nil {
if err := params.Validate(); err != nil {
return err
}
repoPath := getFullPathForRepo(s.reposRoot, params.RepoUID)