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 authored Sep 22, 2023
1 parent 6cd174f commit eb05b57
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 eb05b57

Please sign in to comment.