Open
Conversation
* fix: Handle image stretch on product page
…and course enrollment button (#3109) * fix: Handle missing financial_assistance_form_url on product summary and course enrollment button
…3116) Switch from Boolean(certificate_type) to the new certificate_available boolean for both courses and programs. Bump mitxonline-api-axios to 2026.3.26 which adds certificate_available to programs. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: implement bundle upsell design * fix test --------- Co-authored-by: Ahtesham Quraish <ahtesham.quraish@192.168.10.33>
* fix: implement the new UAI card * small fix --------- Co-authored-by: Ahtesham Quraish <ahtesham.quraish@192.168.10.33> Co-authored-by: Chris Chudzicki <christopher.chudzicki@gmail.com>
Co-authored-by: Ahtesham Quraish <ahtesham.quraish@A006-01455.local>
OpenAPI ChangesShow/hide 26 changes: 0 error, 26 warning, 0 infoUnexpected changes? Ensure your branch is up-to-date with |
Comment on lines
+142
to
+146
| if ( | ||
| learning_resource_obj.resource_type == LearningResourceType.video.name | ||
| and hasattr(learning_resource_obj, "video") | ||
| ): | ||
| serialized_data["video"]["transcript"] = learning_resource_obj.video.transcript |
There was a problem hiding this comment.
Bug: The code attempts to access serialized_data["video"]["transcript"] without first checking if serialized_data["video"] is None. This will cause a TypeError during OpenSearch indexing for videos without a related video object.
Severity: HIGH
Suggested Fix
Before attempting to assign the transcript, add a check to ensure the video key exists in serialized_data and its value is not None. For example, use if serialized_data.get("video"): before the assignment serialized_data["video"]["transcript"] = ....
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: learning_resources_search/serializers.py#L142-L146
Potential issue: The code attempts to assign a transcript to
`serialized_data["video"]["transcript"]`. However, the `video` field in
`serialized_data` can be `None` if a `LearningResource` of type video does not have an
associated `Video` object, as `VideoResourceSerializer` has `allow_null=True`. The
current check, `hasattr(learning_resource_obj, "video")`, only verifies the model field
exists, not that the serialized value is non-null. When `serialized_data["video"]` is
`None`, the assignment will raise a `TypeError`, causing OpenSearch indexing tasks to
fail for these specific resources.
Did we get this right? 👍 / 👎 to inform future reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ahtesham Quraish
Matt Bertrand
Zaman Afzal
Chris Chudzicki