Skip to content

[$250] Attachments - Large image result in attachment not found after being zoomed at first time #76193

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: v9.2.65-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-2203/folder/13176710/41236933/1041757846
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Device used: Windows 10
App Component: Other

Action Performed:

  1. Navigate to https://staging.new.expensify.com/
  2. Open a conversation
  3. Click on "+" on compose box
  4. Click on "Add attachment" and upload the large image
  5. Click on preview
  6. Click to zoom the image

Expected Result:

The large image should be zoomed without disappear or result in "Attachment not found".

Actual Result:

After zooming the large image the first time it results in "Attachment not found".

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug7014499_1764208827729.bandicam_2025-11-26_20-42-24-211_-_Trim.mp4

Image

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @mohammadjafarinejad
Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022031718775101842607
  • Upwork Job ID: 2031718775101842607
  • Last Price Increase: 2026-03-11

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 27, 2025
  2. melvin-bot commented on Nov 27, 2025

    @melvin-bot

    Triggered auto assignment to @garrettmknight (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  3. mitarachim commented on Nov 27, 2025

    @mitarachim
    Author

    Hello @garrettmknight QA team found issue about aspect ratio of image is smaller than expected when zoom in the image a second time. The image is not posible to see , are we need create new issue in this case? or this is consider same root cause with this issue ?

    Steps :

    1. Navigate to https://staging.new.expensify.com/
    2. Open a conversation
    3. Click on "+" on compose box
    4. Click on "Add attachment" and upload the large image
    5. Click on preview
    6. Click to zoom the image
    7. Close the view
    8. Repeat step 5 and 6
    Bug7014502_1764209272758.bandicam_2025-11-26_20-42-24-211_-_Trim1.mp4
  4. melvin-bot commented on Dec 1, 2025

    @melvin-bot

    @garrettmknight Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Dec 2, 2025
  6. changed the title [-]Attachments - Large image result in attachment not found after being zoomed at first time[/-] [+][$250] Attachments - Large image result in attachment not found after being zoomed at first time[/+] on Dec 2, 2025
  7. melvin-bot commented on Dec 2, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 2, 2025
  9. melvin-bot commented on Dec 2, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @alitoshmatov (External)

  10. 97 remaining items

  11. melvin-bot commented on Mar 11, 2026

    @melvin-bot

    Current assignee @garrettmknight is eligible for the Bug assigner, not assigning anyone new.

  12. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 11, 2026
  13. melvin-bot commented on Mar 11, 2026

    @melvin-bot

    Current assignee @ahmedGaber93 is eligible for the External assigner, not assigning anyone new.

  14. melvin-bot commented on Mar 11, 2026

    @melvin-bot
  15. removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Mar 11, 2026
  16. melvin-bot commented on Mar 11, 2026

    @melvin-bot

    📣 @mohammadjafarinejad You have been assigned to this job!
    Please apply to the Upwork job and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review 🧑‍💻
    Once you apply to this job, your Upwork ID will be stored and you will be automatically hired for future jobs!
    Keep in mind: Code of Conduct | Contributing 📖

  17. MelvinBot commented on Mar 11, 2026

    @MelvinBot
    Contributor

    🔍 Issue Analysis

    Summary: Uploading a large image (>7000px in either dimension) and viewing it in the attachment modal causes "Attachment not found" after the upload completes, because the expo-image component retains stale blob URL state when the source transitions to a server URL.

    Status: This issue has been fixed and deployed via PR #81631 (merged 2026-02-18). The analysis below documents the root cause and fix for reference.


    Root Cause

    The bug stems from a state transition race in AttachmentView for high-resolution images (either dimension >7000px):

    1. During upload: The image source is a local blob: URL. Since isHighResolution=true AND isUploaded=false, AttachmentView renders a DefaultAttachmentView placeholder ("Image too large").

    2. Upload completes: The report object populates in Onyx, causing isUploaded to flip to true (via !isEmptyObject(report) in CarouselItem.tsx:101).

    3. Source switch: Now isHighResolution=true AND isUploaded=true, so imageSource switches to previewSource (a server-side resized URL like .1024.jpg) at AttachmentView/index.tsx:327.

    4. Stale cache: Without remounting, the AttachmentViewImage → ImageView → Image → expo-image component chain reuses its internal state. The expo-image component had stale references from the blob URL phase. Combined with the Image component's aggressive memoization (only comparing source reference at Image/index.tsx:181-183), this caused the image load to fail, showing "Attachment not found".

    Fix Applied (PR #81631)

    Added a key prop to AttachmentViewImage that changes when the image transitions from upload to uploaded state:

    key={attachmentID ? `${attachmentID}-${isHighResolution && isUploaded ? 'preview' : 'full'}` : undefined}

    When isHighResolution && isUploaded flips from false to true, the key changes from {id}-full to {id}-preview, forcing React to unmount the old component (clearing stale expo-image cache) and mount a fresh one that properly loads the new server URL.

    Note on Scope

    This fix only applies to high-resolution images (>7000px). For normal-resolution images, the key prop does not vary based on upload state. If a similar blob-to-server-URL transition issue were to occur for normal images, it would not be covered by this fix, though the rendering path for normal images is different and less susceptible to this race.

  18. garrettmknight commented on Mar 11, 2026

    @garrettmknight
    Contributor
  19. aimane-chnaif commented on Mar 11, 2026

    @aimane-chnaif
    Contributor

    @ahmedGaber93's reviewer here. I am not due any payment.

  20. garrettmknight commented on Mar 11, 2026

    @garrettmknight
    Contributor

    Payment Summary

  21. JmillsExpensify commented on Mar 19, 2026

    @JmillsExpensify
    Contributor

    $250 approved for @ahmedGaber93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions