Skip to content

Commit

Permalink
🐛 fix for users { * }: check for nil file data before returning path
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeffrey committed Sep 22, 2023
1 parent 6cd174f commit 1166f3c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion providers/os/resources/privatekey.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
Expand All @@ -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
}

0 comments on commit 1166f3c

Please sign in to comment.