diff options
Diffstat (limited to 'routers/api/packages/vagrant/vagrant.go')
-rw-r--r-- | routers/api/packages/vagrant/vagrant.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/routers/api/packages/vagrant/vagrant.go b/routers/api/packages/vagrant/vagrant.go index 3afaa5de1f..36fc41f581 100644 --- a/routers/api/packages/vagrant/vagrant.go +++ b/routers/api/packages/vagrant/vagrant.go @@ -24,14 +24,13 @@ import ( ) func apiError(ctx *context.Context, status int, obj any) { - helper.LogAndProcessError(ctx, status, obj, func(message string) { - ctx.JSON(status, struct { - Errors []string `json:"errors"` - }{ - Errors: []string{ - message, - }, - }) + message := helper.ProcessErrorForUser(ctx, status, obj) + ctx.JSON(status, struct { + Errors []string `json:"errors"` + }{ + Errors: []string{ + message, + }, }) } @@ -218,7 +217,7 @@ func UploadPackageFile(ctx *context.Context) { } func DownloadPackageFile(ctx *context.Context) { - s, u, pf, err := packages_service.GetFileStreamByPackageNameAndVersion( + s, u, pf, err := packages_service.OpenFileForDownloadByPackageNameAndVersion( ctx, &packages_service.PackageInfo{ Owner: ctx.Package.Owner, @@ -229,6 +228,7 @@ func DownloadPackageFile(ctx *context.Context) { &packages_service.PackageFileInfo{ Filename: ctx.PathParam("provider"), }, + ctx.Req.Method, ) if err != nil { if errors.Is(err, packages_model.ErrPackageNotExist) || errors.Is(err, packages_model.ErrPackageFileNotExist) { |