mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-07 05:42:42 +00:00
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.
This commit is contained in:
+3
-2
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user