[code-1822-maint] minor requested changes (#2017)

ritik/code-1773
Enver Biševac 2024-04-26 23:51:26 +00:00 committed by Harness
parent fb5e38dd2c
commit ed97ff8398
3 changed files with 7 additions and 8 deletions

View File

@ -542,11 +542,10 @@ var queryParamArchivePaths = openapi3.ParameterOrRef{
var queryParamArchivePrefix = openapi3.ParameterOrRef{
Parameter: &openapi3.Parameter{
Name: request.QueryParamArchivePrefix,
In: openapi3.ParameterInQuery,
Description: ptr.String("Prepend <prefix>/ to paths in the archive. Can be repeated; its rightmost value" +
" is used for all tracked files."),
Required: ptr.Bool(false),
Name: request.QueryParamArchivePrefix,
In: openapi3.ParameterInQuery,
Description: ptr.String("Prepend <prefix>/ to paths in the archive."),
Required: ptr.Bool(false),
Schema: &openapi3.SchemaOrRef{
Schema: &openapi3.Schema{
Type: ptrSchemaType(openapi3.SchemaTypeString),

View File

@ -25,7 +25,7 @@ import (
)
const (
PathParamArchiveRefs = "*"
PathParamArchiveGitRef = "*"
QueryParamArchivePaths = "path"
QueryParamArchivePrefix = "prefix"
QueryParamArchiveAttributes = "attributes"
@ -37,7 +37,7 @@ func ParseArchiveParams(r *http.Request) (api.ArchiveParams, string) {
// separate rev and ref part from url, for example:
// api/v1/repos/root/demo/+/archive/refs/heads/main.zip
// will produce rev=refs/heads and ref=main.zip
rev, filename := filepath.Split(PathParamOrEmpty(r, PathParamArchiveRefs))
rev, filename := filepath.Split(PathParamOrEmpty(r, PathParamArchiveGitRef))
// use ext as format specifier
ext := filepath.Ext(filename)
// get name of the ref from filename

View File

@ -354,7 +354,7 @@ func setupRepos(r chi.Router,
r.Get("/codeowners/validate", handlerrepo.HandleCodeOwnersValidate(repoCtrl))
r.Get(fmt.Sprintf("/archive/%s", request.PathParamArchiveRefs), handlerrepo.HandleArchive(repoCtrl))
r.Get(fmt.Sprintf("/archive/%s", request.PathParamArchiveGitRef), handlerrepo.HandleArchive(repoCtrl))
SetupPullReq(r, pullreqCtrl)