From 7e65cb260bcf1c28f0be179f204d638743d385a7 Mon Sep 17 00:00:00 2001 From: Jacob Bednarz Date: Fri, 23 Dec 2022 14:24:53 +1100 Subject: [PATCH] workers: default body to provided payload This was previously incorrectly always using `body` (an uninitialised slice of bytes) for the script payload when the configuration was not for an ES module upload. Fixes the upload so that both types are covered. --- .changelog/1155.txt | 3 +++ workers.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .changelog/1155.txt diff --git a/.changelog/1155.txt b/.changelog/1155.txt new file mode 100644 index 000000000..d2572b3df --- /dev/null +++ b/.changelog/1155.txt @@ -0,0 +1,3 @@ +```release-note:bug +workers: correctly set `body` value for non-ES module uploads +``` diff --git a/workers.go b/workers.go index d5474bc03..b1b3ed7f5 100644 --- a/workers.go +++ b/workers.go @@ -214,10 +214,10 @@ func (api *API) UploadWorker(ctx context.Context, rc *ResourceContainer, params return WorkerScriptResponse{}, ErrMissingAccountID } + body := []byte(params.Script) var ( contentType = "application/javascript" err error - body []byte ) if params.Module || len(params.Bindings) > 0 {