From fa0d2860f089d04f129843db10a40071ea67d645 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Wed, 9 Oct 2024 14:30:06 +0200 Subject: [PATCH] fix multidist in publish --- api/publish.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/api/publish.go b/api/publish.go index 19f9d2ad..0eda0083 100644 --- a/api/publish.go +++ b/api/publish.go @@ -179,11 +179,10 @@ type publishedRepoCreateParams struct { // @Failure 500 {object} Error "Internal Error" // @Router /api/publish/{prefix} [post] func apiPublishRepoOrSnapshot(c *gin.Context) { - var b publishedRepoCreateParams - param := parseEscapedPath(c.Params.ByName("prefix")) storage, prefix := deb.ParsePrefix(param) + var b publishedRepoCreateParams if c.Bind(&b) != nil { return } @@ -248,6 +247,11 @@ func apiPublishRepoOrSnapshot(c *gin.Context) { return } + multiDist := false + if b.MultiDist != nil { + multiDist = *b.MultiDist + } + taskName := fmt.Sprintf("Publish %s repository %s/%s with components \"%s\" and sources \"%s\"", b.SourceKind, published.StoragePrefix(), published.Distribution, strings.Join(components, `", "`), strings.Join(names, `", "`)) @@ -279,7 +283,7 @@ func apiPublishRepoOrSnapshot(c *gin.Context) { } } - published, err := deb.NewPublishedRepo(storage, prefix, b.Distribution, b.Architectures, components, sources, collectionFactory, b.MultiDist) + published, err := deb.NewPublishedRepo(storage, prefix, b.Distribution, b.Architectures, components, sources, collectionFactory, multiDist) if err != nil { return &task.ProcessReturnValue{Code: http.StatusInternalServerError, Value: nil}, fmt.Errorf("unable to publish: %s", err) } @@ -798,6 +802,10 @@ func apiPublishUpdate(c *gin.Context) { published.AcquireByHash = *b.AcquireByHash } + if b.MultiDist != nil { + published.MultiDist = *b.MultiDist + } + resources := []string{string(published.Key())} taskName := fmt.Sprintf("Update published %s repository %s/%s", published.SourceKind, published.StoragePrefix(), published.Distribution)