From 49184c9163121d177c5de30bc915f4e5400b20a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Roth?= Date: Wed, 17 Jul 2024 23:13:45 +0200 Subject: [PATCH] fix apiReposCopyPackage getting corrupt file name it seems c.Params.ByName("file") should not be used inside maybeRunTaskInBackground, as the content may be corrupted sometimes. --- api/repos.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/api/repos.go b/api/repos.go index fac990a5..d6cc4da6 100644 --- a/api/repos.go +++ b/api/repos.go @@ -419,6 +419,7 @@ func apiReposPackageFromDir(c *gin.Context) { func apiReposCopyPackage(c *gin.Context) { dstRepoName := c.Params.ByName("name") srcRepoName := c.Params.ByName("src") + fileName := c.Params.ByName("file") jsonBody := struct { WithDeps bool `json:"with-deps,omitempty"` @@ -513,9 +514,9 @@ func apiReposCopyPackage(c *gin.Context) { // srcList.Filter|FilterWithProgress only accept query list queries := make([]deb.PackageQuery, 1) - queries[0], err = query.Parse(c.Params.ByName("file")) + queries[0], err = query.Parse(fileName) if err != nil { - return &task.ProcessReturnValue{Code: http.StatusUnprocessableEntity, Value: nil}, fmt.Errorf("unable to parse query: %s", err) + return &task.ProcessReturnValue{Code: http.StatusUnprocessableEntity, Value: nil}, fmt.Errorf("unable to parse query '%s': %s", fileName, err) } toProcess, err := srcList.FilterWithProgress(queries, jsonBody.WithDeps, dstList, context.DependencyOptions(), architecturesList, context.Progress())