From eb05b57432e245ee40ce9c8fb2c4e469ce4b8b24 Mon Sep 17 00:00:00 2001 From: vjeffrey Date: Fri, 22 Sep 2023 04:14:15 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20for=20users=20{=20*=20}:?= =?UTF-8?q?=20check=20for=20nil=20file=20data=20before=20returning=20path?= =?UTF-8?q?=20(#1819)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- providers/os/resources/privatekey.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/providers/os/resources/privatekey.go b/providers/os/resources/privatekey.go index 2cc79e7d3a..6e997b39a8 100644 --- a/providers/os/resources/privatekey.go +++ b/providers/os/resources/privatekey.go @@ -16,7 +16,6 @@ func initPrivatekey(runtime *plugin.Runtime, args map[string]*llx.RawData) (map[ if !ok { return nil, nil, errors.New("wrong type for 'path' in privatekey initialization, it must be a string") } - f, err := CreateResource(runtime, "file", map[string]*llx.RawData{ "path": llx.StringData(path), }) @@ -36,6 +35,9 @@ func (r *mqlPrivatekey) id() (string, error) { if file.Error != nil { return "", file.Error } + if file.Data == nil { + return "", errors.New("no file provided") + } return "privatekey:" + file.Data.Path.Data, nil }