Fix Android image loads by attaching auth headers#9554
Conversation
|
@nickmisasi: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsI understand the commands that are listed here |
|
@coderabbitai review |
There was a problem hiding this comment.
Pull request overview
Fixes an Android regression where expo-image requests to authenticated Mattermost API image endpoints were made without auth headers (leading to 401 and broken rendering), by injecting GET auth headers for first-party /api/v4/... image URLs inside the shared ExpoImage wrapper.
Changes:
- Add
NetworkManager-derived GET request headers intosource.headersfor server API image URLs. - Apply the same header injection to
placeholderto keep progressive/placeholder loading authenticated. - Add
shouldAttachServerAuthHeadersto scope header injection to first-party API URLs.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@cursor can you fix the snapshots on this pr? |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Coverage Comparison ReportGenerated on February 27, 2026 at 02:10:13 UTC |
|
/update-branch |
The expo_image/index.tsx hunks in 9325-full.diff were generated before the NetworkManager/header-handling code was added to ExpoImage. The stale context lines caused patch's fuzzy matching to apply ExpoImage hunks to ExpoImageBackground instead, then ExpoImageBackground hunks failed because those sections were already modified. Regenerated the expo_image diff hunks to match the current file state with proper context lines for both ExpoImage (with header handling) and ExpoImageBackground components. https://claude.ai/code/session_01SGXWQzxrcPpWsq2YrjoUwd Co-authored-by: Claude <noreply@anthropic.com>
|
/cherry-pick release-2.37 |
|
Cherry pick is scheduled. |
|
/cherry-pick release-2.38 |
* Fix images not loading on android" * Update app/components/expo_image/index.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update snapshots and remove accept * Fix 16KB page size patch failing due to stale diff context (#9555) The expo_image/index.tsx hunks in 9325-full.diff were generated before the NetworkManager/header-handling code was added to ExpoImage. The stale context lines caused patch's fuzzy matching to apply ExpoImage hunks to ExpoImageBackground instead, then ExpoImageBackground hunks failed because those sections were already modified. Regenerated the expo_image diff hunks to match the current file state with proper context lines for both ExpoImage (with header handling) and ExpoImageBackground components. https://claude.ai/code/session_01SGXWQzxrcPpWsq2YrjoUwd Co-authored-by: Claude <noreply@anthropic.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Your Name <larkox@gmail.com> Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: Claude <noreply@anthropic.com> (cherry picked from commit 46d4679)
|
Cherry pick is scheduled. |
* Fix images not loading on android" * Update app/components/expo_image/index.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update snapshots and remove accept * Fix 16KB page size patch failing due to stale diff context (#9555) The expo_image/index.tsx hunks in 9325-full.diff were generated before the NetworkManager/header-handling code was added to ExpoImage. The stale context lines caused patch's fuzzy matching to apply ExpoImage hunks to ExpoImageBackground instead, then ExpoImageBackground hunks failed because those sections were already modified. Regenerated the expo_image diff hunks to match the current file state with proper context lines for both ExpoImage (with header handling) and ExpoImageBackground components. https://claude.ai/code/session_01SGXWQzxrcPpWsq2YrjoUwd Co-authored-by: Claude <noreply@anthropic.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Your Name <larkox@gmail.com> Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: Claude <noreply@anthropic.com> (cherry picked from commit 46d4679)
* Fix images not loading on android" * Update app/components/expo_image/index.tsx * Update snapshots and remove accept * Fix 16KB page size patch failing due to stale diff context (#9555) The expo_image/index.tsx hunks in 9325-full.diff were generated before the NetworkManager/header-handling code was added to ExpoImage. The stale context lines caused patch's fuzzy matching to apply ExpoImage hunks to ExpoImageBackground instead, then ExpoImageBackground hunks failed because those sections were already modified. Regenerated the expo_image diff hunks to match the current file state with proper context lines for both ExpoImage (with header handling) and ExpoImageBackground components. https://claude.ai/code/session_01SGXWQzxrcPpWsq2YrjoUwd --------- (cherry picked from commit 46d4679) Co-authored-by: Nick Misasi <nick.misasi@mattermost.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Your Name <larkox@gmail.com> Co-authored-by: Claude <noreply@anthropic.com>
* Fix images not loading on android" * Update app/components/expo_image/index.tsx * Update snapshots and remove accept * Fix 16KB page size patch failing due to stale diff context (#9555) The expo_image/index.tsx hunks in 9325-full.diff were generated before the NetworkManager/header-handling code was added to ExpoImage. The stale context lines caused patch's fuzzy matching to apply ExpoImage hunks to ExpoImageBackground instead, then ExpoImageBackground hunks failed because those sections were already modified. Regenerated the expo_image diff hunks to match the current file state with proper context lines for both ExpoImage (with header handling) and ExpoImageBackground components. https://claude.ai/code/session_01SGXWQzxrcPpWsq2YrjoUwd --------- (cherry picked from commit 46d4679) Co-authored-by: Nick Misasi <nick.misasi@mattermost.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Your Name <larkox@gmail.com> Co-authored-by: Claude <noreply@anthropic.com>
Summary
401responses and failed rendering.ExpoImagewrapper inapp/components/expo_image/index.tsxto attach server GET request headers fromNetworkManageronly for first-party API URLs (<server>/api/v4/...).sourceandplaceholderimage objects, so progressive image flows remain authenticated throughout.Why this is necessary
expo-image(Glide on Android)./api/v4/users/.../image,/api/v4/files/...) that require session auth.401and blurred/empty images.Implementation details
shouldAttachServerAuthHeaders(uri, serverUrl)to strictly scope header injection to same-server API URLs.NetworkManager.getClient(serverUrl).getRequestHeaders('GET').{...requestHeaders, ...existingHeaders}to preserve any per-source header overrides.cacheKey/cachePathbehavior unchanged to avoid altering image caching semantics.Risk and scope
app/components/expo_image/index.tsx.Test plan
401for image fetches.Made with Cursor