[MM-68690] Null check on missing headers when loading resources#3812
Merged
Conversation
Contributor
|
❌ E2E Test Setup Failed Failed to create E2E test instances: failed to create installation: failed with status code 409 |
Contributor
|
Cherry pick is scheduled. |
Member
Author
|
/cherry-pick release-5.13 |
Contributor
|
Cherry pick is scheduled. |
devinbinnie
added a commit
that referenced
this pull request
May 8, 2026
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.
Summary
Certain network responses can be missing headers that the downloads manager assumed were always present, leading to an unhandled error.
This PR adds defensive null checks when reading response headers in the downloads handler.
Ticket Link
https://mattermost.atlassian.net/browse/MM-68690
Release Note
Change Impact: 🟢 Low
Regression Risk: Minimal. The changes are purely defensive—adding optional chaining operators (
?.) and optional method calls (?.join?.()) to guard against missingcontent-dispositionheaders in network responses. The logic flow remains unchanged when headers are present, and the new null checks only prevent crashes in edge cases. The fix is scoped to a single, isolated method (webRequestOnHeadersReceivedHandler) within the downloads feature. No shared utilities, base classes, or widely-imported modules are affected.QA Recommendation: Minimal manual QA required. The fix addresses a specific edge case (missing headers) that is already covered by an added unit test. Basic smoke testing of the downloads feature is recommended to verify that normal download flows (with complete headers) remain unaffected, but comprehensive testing can rely on the unit test coverage.
Generated by CodeRabbitAI