Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix conversion of primitives with NO type #1456

Merged
merged 1 commit into from
Aug 8, 2023
Merged

Conversation

czunker
Copy link
Contributor

@czunker czunker commented Aug 7, 2023

In case we have a resource without data, it also does not have a type. We need to catch this to prevent the error: cannot convert primitive with NO type information

This happens, e.g., when we test for the exists of a file before doing anything else with the resource.

Partially-Fixes #957

In case we have a resource without data, it also does not have a type.
We need to catch this to prevent the error: `cannot convert primitive with NO type information`

This happens, e.g., when we test for the exists of a file before doing anything else with the resource.

Partially-Fixes #957

Signed-off-by: Christian Zunker <[email protected]>
@czunker
Copy link
Contributor Author

czunker commented Aug 7, 2023

Before:
Screenshot from 2023-08-07 10-12-02

and after in the UI:
Screenshot from 2023-08-07 10-22-20

@@ -461,7 +461,8 @@ func (r *Result) RawData() *RawData {

data := &RawData{}
if r.Data != nil {
if r.Data.IsNil() {
// The type can be empty, when we do not have data
if r.Data.IsNil() || types.Type(r.Data.Type).IsEmpty() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point, als r.Data.(Map|Array|Value) are empty. We could also add these as checks.

@czunker
Copy link
Contributor Author

czunker commented Aug 7, 2023

@chris-rock chris-rock requested a review from jaym August 7, 2023 10:05
@czunker czunker merged commit 6319144 into main Aug 8, 2023
9 checks passed
@czunker czunker deleted the christian/fix_no_type branch August 8, 2023 10:54
@github-actions github-actions bot locked and limited conversation to collaborators Aug 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RawData fails for some resources
2 participants