Skip to content

Commit

Permalink
fix a potential bug in add attachment
Browse files Browse the repository at this point in the history
  • Loading branch information
consolethinks committed Aug 19, 2024
1 parent 7ed2630 commit e5cc2bc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions datasetIngestor/addAttachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ func CreateAttachmentMap(datasetId string, caption string, datasetMetadata map[s
metadata["ownerGroup"], _ = ownerGroup.(string)
}
if accessGroups, ok := datasetMetadata["accessGroups"]; ok {
metadata["accessGroups"], ok = accessGroups.([]string)
if !ok {
// NOTE: not sure if this is correct, because this would only work if the underlying structure of interface{} is EXACTLY []interface{}
metadata["accessGroups"], _ = accessGroups.([]interface{})
if metadata["accessGroups"], ok = accessGroups.([]string); !ok {
metadata["accessGroups"] = accessGroups // fallback (might fail at JSON conversion later)
}
}
return metadata, nil
Expand Down

0 comments on commit e5cc2bc

Please sign in to comment.