App icon indicating copy to clipboard operation
App copied to clipboard

[$175] Receipts are not showing fully when sent to [email protected]

Open izarutskaya opened this issue 1 month ago • 34 comments

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.5.10-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @Getrudygidashang Slack conversation (hyperlinked to channel name): #expensify_bugs

Action Performed:

Users forward the receipt to [email protected] using the email address associated with their Expensify account

Expected Result:

The receipt should be fully displayed when added directly to the expense.

Actual Result:

The receipt does not show fully displayed when added to users account.

Workaround:

Unknown

Platforms:

Select the officially supported platforms where the issue was reproduced:

  • [ ] Android: App
  • [ ] Android: mWeb Chrome
  • [ ] iOS: App
  • [ ] iOS: mWeb Safari
  • [ ] iOS: mWeb Chrome
  • [x] Windows: Chrome
  • [ ] MacOS: Chrome / Safari

Screenshots/Videos

https://github.com/user-attachments/assets/3e7ac8a4-a591-4217-9ac0-db67325352dd

https://github.com/user-attachments/assets/debf8e26-4cbd-46e3-ac4e-cb2f4621d4af

View all open jobs on GitHub

Upwork Automation - Do Not Edit
Issue OwnerCurrent Issue Owner: @chuckdries

izarutskaya avatar Oct 15 '26 17:10 izarutskaya

Proposal

⚠️ Medium confidence. I confirmed the cropping in code but couldn't watch the repro videos. Please check one thing first: open the receipt full screen. If the full-screen view is also cut off, the stored file is truncated by the backend and this App fix won't help.

What is the root cause of that problem?

Receipts sent by email are often very tall images, such as long HTML email bodies turned into a JPG. In the expense details view, the receipt preview is a fixed 16:9 box:

The image inside the box is drawn as a thumbnail, pinned to the top (ReceiptImage/index.tsx:214-232). No resize mode is passed, so it falls back to cover (ImageWithSizeCalculation.tsx:88). The image fills the box's width, and everything below the top part is cut off.

No recent PR introduced this; the preview has always cropped this way. Clicking the preview opens the full-screen viewer, which uses contain and shows the whole receipt.

What changes do you think we should make in order to solve the problem?

When the receipt shows in the fixed-size box, pass resizeMode contain to ThumbnailImage in ReceiptImage. Pass it from MoneyRequestReceiptView only for the non-fillSpace case, so other thumbnails stay the same. The whole receipt then fits in the box, with empty space at the sides.

This changes how the preview looks, so the design team should confirm it before we implement it.

What alternative solutions did you explore? (Optional)

  • Treat it as expected behavior. The preview is a crop by design, and clicking it shows the full receipt.
  • Size the box to the image's own aspect ratio, the way the wide receipt panel does (flexibleHeight), with a maximum height. This shows more of the receipt but can make the right-hand panel very tall.
Investigation details
  • The narrow preview loads the .1024.jpg thumbnail (shouldUseThumbnailImage={!fillSpace}). The wide receipt panel (WideRHPReceiptPanel.tsx:95) uses the original image and its real aspect ratio, so it should show the full receipt.
  • For PDF receipts, the preview shows only page 1 (ReportActionItemImage.tsx:206). If the forwarded email became a multi-page PDF, "not fully displayed" may mean the missing pages.
  • The full-screen viewer uses contain (ImageView/index.tsx:123).
  • App doesn't size email receipts differently from other receipts. The backend turns the email into an image or PDF.

Questions for the reporter:

  1. Is the receipt also cut off in the full-screen view? If yes, the backend is producing a truncated file, and an internal engineer needs to investigate.
  2. Is the stored receipt a JPG or a multi-page PDF?

Possibly related: [Exploratory] Receipt is not fully visible, blank space appears on the report page


Next Steps for Contributor+ team: To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/104138) to create a draft PR. To refine: @MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.


view run

MelvinBot avatar Oct 15 '26 18:10 MelvinBot

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

melvin-bot[bot] avatar Oct 15 '26 18:10 melvin-bot[bot]

Job added to Upwork: https://www.upwork.com/jobs/~022110793935688626891

melvin-bot[bot] avatar Oct 15 '26 18:10 melvin-bot[bot]

Proposal

What is the root cause of that problem?

The receipt preview can crop tall images, including long receipts created from forwarded emails. When MoneyRequestReceiptView is not in fillSpace mode, it uses the fixed 16:9 expenseViewImage / expenseViewImageSmall styles (src/styles/index.ts). It then renders ReportActionItemImage with shouldUseThumbnailImage={!fillSpace}.

For ordinary receipt thumbnails, ReportActionItemImage renders ReceiptImage → ThumbnailImage without an explicit resize mode. The thumbnail defaults to cover and top positioning, so the preview only displays part of a tall image within that 16:9 viewport. The fullscreen image viewer uses contain instead.

One check before implementing: Please confirm whether the complete emailed receipt is visible in the fullscreen/expanded viewer. If the original is also truncated there, this is an email-import/backend issue, not a preview layout issue, and changing the thumbnail would hide the real problem.

What changes do you think we should make in order to solve the problem?

If the original receipt is complete and only the preview is cropped:

  1. Allow ReportActionItemImage to pass an optional image resize mode through to ReceiptImage / ThumbnailImage.
  2. In the fixed-size expense receipt preview, use contain for image receipts so the entire tall image fits inside the existing area. Keep the current behavior elsewhere, especially e-receipts, PDFs/page overlays, and full-height receipt views.
  3. Add focused coverage for portrait and landscape receipt previews, and manually verify expanded/fullscreen display. Confirm the contained/letterboxed preview treatment with design before changing its appearance.

If fullscreen is also truncated, inspect the receipt generated by the forwarded-email pipeline first and keep the UI unchanged.

What alternative solutions did you explore? (Optional)

Growing the preview to the image's full aspect ratio would also reveal the whole receipt, but can make the details panel impractically tall. A scoped contain setting is smaller and safer if QA confirms this is only a preview problem.

Investigated with AI assistance; code paths reviewed, but I have not claimed to reproduce the forwarded-email case or run a UI test yet.

bconnnnn avatar Oct 16 '26 03:10 bconnnnn

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0126a1db3ee4419254

Proposal

What is the root cause of that problem?

Forwarded email receipts (e.g. HTML order confirmations turned into images) often have very tall vertical aspect ratios (e.g., 1:3 or 1:4).

  1. In src/components/ReportActionItem/MoneyRequestReceiptView.tsx (line 622), when !fillSpace (the standard expense preview in the right-hand panel), the preview container is constrained to a fixed 16:9 ratio via styles.expenseViewImage / styles.expenseViewImageSmall.
  2. MoneyRequestReceiptView renders ReportActionItemImage (line 791) with shouldUseThumbnailImage={!fillSpace}, but ReportActionItemImage does not accept or forward an explicit resizeMode prop.
  3. In src/components/ReportActionItem/ReportActionItemImage.tsx (lines 199–232), propsObj passed to ReceiptImage does not include resizeMode.
  4. In src/components/ReceiptImage/index.tsx (line 151), resizeMode defaults to undefined and is forwarded to ThumbnailImage (line 231) -> ImageWithSizeCalculation (line 160).
  5. In ImageWithSizeCalculation.tsx (line 88), when resizeMode is undefined, it defaults to 'cover'.

Because resizeMode="cover" is applied to a tall vertical image inside a fixed 16:9 container, the image expands to match the width and its entire bottom portion is cropped outside the viewport. When opening full-screen (ImageView), resizeMode="contain" is used, showing the full image.

What changes do you think we should make in order to solve the problem?

  1. In src/components/ReportActionItem/ReportActionItemImage.tsx:
    • Extend ReportActionItemImageProps to accept an optional resizeMode?: ImageProps['resizeMode'].
    • Forward resizeMode into propsObj across the branches where ReceiptImage is constructed.
diff --git a/src/components/ReportActionItem/ReportActionItemImage.tsx b/src/components/ReportActionItem/ReportActionItemImage.tsx
--- a/src/components/ReportActionItem/ReportActionItemImage.tsx
+++ b/src/components/ReportActionItem/ReportActionItemImage.tsx
@@ -69,6 +69,7 @@ type ReportActionItemImageProps = {
     filename?: string;
 
+    resizeMode?: ImageProps['resizeMode'];
+
     /** Whether the receipt is attached to a money request from the track expense flow */
@@ -208,6 +209,7 @@ function ReportActionItemImage({
             fallbackIconSize: isSingleImage ? variables.iconSizeSuperLarge : variables.iconSizeExtraLarge,
             isAuthTokenRequired: true,
+            resizeMode,
 
             // If the image is full height, use initial position to make sure it will grow properly to fill the container
@@ -226,6 +228,7 @@ function ReportActionItemImage({
             // If the image is full height, use initial position to make sure it will grow properly to fill the container
             shouldUseInitialObjectPosition: isMapDistanceRequest && !shouldUseFullHeight,
             isEmptyReceipt,
+            resizeMode,
             onPress,
         };
  1. In src/components/ReportActionItem/MoneyRequestReceiptView.tsx:
    • Pass resizeMode={!fillSpace ? 'contain' : undefined} to <ReportActionItemImage /> (around line 791).
    • This ensures that when the receipt is displayed inside the fixed 16:9 thumbnail frame (!fillSpace), the whole receipt is contained without being cropped.
    • For fillSpace (wide receipt panel), it retains its current dynamic sizing behavior without letterboxing.
diff --git a/src/components/ReportActionItem/MoneyRequestReceiptView.tsx b/src/components/ReportActionItem/MoneyRequestReceiptView.tsx
--- a/src/components/ReportActionItem/MoneyRequestReceiptView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestReceiptView.tsx
@@ -790,6 +790,7 @@ function MoneyRequestReceiptView({
                                         <>
                                             <ReportActionItemImage
+                                                resizeMode={!fillSpace ? 'contain' : undefined}
                                                 shouldUseThumbnailImage={!fillSpace}
                                                 shouldUseFullHeight={fillSpace}
                                                 canZoomReceipt={canZoomReceipt}
  1. Verify edge cases:
    • E-receipts and distance map receipts already have dedicated handling and will remain unaffected.
    • PDF receipts: The first-page thumbnail will also scale cleanly without cropping the bottom of the invoice.

What alternative solutions did you explore? (Optional)

  • Dynamically calculating preview height based on image aspect ratio: While this would eliminate letterboxing at the sides, email receipts can be 3000px+ tall, which would blow up the expense details panel layout. Using resizeMode="contain" inside the existing bounded container is standard across the app, clean, and safe.

Metarenessans avatar Oct 17 '26 11:10 Metarenessans

📣 @Metarenessans! 📣 Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork. Please follow these steps:

  1. Make sure you've read and understood the contributing guidelines.
  2. Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
  3. Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
  4. Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details. Screen Shot 2022-11-16 at 4 42 54 PM Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>

melvin-bot[bot] avatar Oct 17 '26 11:10 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0126a1db3ee4419254

Metarenessans avatar Oct 17 '26 11:10 Metarenessans

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 17 '26 11:10 melvin-bot[bot]

Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0163955a2ba22190aa

Proposal

Please re-state the problem that we are trying to solve in this issue.

When receipts are forwarded to [email protected] (such as tall, vertical order confirmations or invoice emails), the receipt preview in the expense details panel crops out the bottom half of the receipt. When tapping the receipt to open the full-screen modal, the complete receipt is visible.

What is the root cause of that problem?

  1. In src/components/ReportActionItem/MoneyRequestReceiptView.tsx (line 755), when !fillSpace (standard expense preview in RHP), the receipt image sits in a fixed 16:9 container (styles.expenseViewImage / styles.expenseViewImageSmall).
  2. MoneyRequestReceiptView delegates rendering to ReportActionItemImage. However, ReportActionItemImageProps does not accept or pass a resizeMode prop.
  3. In src/components/ReportActionItem/ReportActionItemImage.tsx, the constructed propsObj passed to ReceiptImage lacks resizeMode.
  4. While ReceiptImage (src/components/ReceiptImage/index.tsx, lines 119, 151, 231) already accepts and forwards resizeMode to ThumbnailImage / ImageWithSizeCalculation, omitting resizeMode causes ImageWithSizeCalculation.tsx (line 88) to default to 'cover'.
  5. Because resizeMode="cover" is applied to tall vertical email receipts inside a 16:9 container, the top of the receipt expands to fit the full width, causing the entire bottom section (line items, taxes, and total amounts) to be cropped out of view.

What changes do you think we should make in order to solve the problem?

  1. In src/components/ReportActionItem/ReportActionItemImage.tsx:

    • Add optional resizeMode?: ReceiptImageProps['resizeMode']; to ReportActionItemImageProps.
    • Forward resizeMode into propsObj across the thumbnail/image branches.
  2. In src/components/ReportActionItem/MoneyRequestReceiptView.tsx:

    • Pass resizeMode={!fillSpace ? 'contain' : undefined} to <ReportActionItemImage />.
    • When displayed inside the bounded 16:9 thumbnail frame (!fillSpace), the whole receipt fits cleanly via contain without cutting off bottom receipt details.
    • For fillSpace (wide desktop view), it preserves full dynamic height without letterboxing.
--- a/src/components/ReportActionItem/MoneyRequestReceiptView.tsx
+++ b/src/components/ReportActionItem/MoneyRequestReceiptView.tsx
@@ -753,6 +753,7 @@ function MoneyRequestReceiptView({
                                     {({isHovering}) => (
                                         <>
                                             <ReportActionItemImage
+                                                resizeMode={!fillSpace ? 'contain' : undefined}
                                                 shouldUseThumbnailImage={!fillSpace}
                                                 shouldUseFullHeight={fillSpace}
                                                 canZoomReceipt={canZoomReceipt}
--- a/src/components/ReportActionItem/ReportActionItemImage.tsx
+++ b/src/components/ReportActionItem/ReportActionItemImage.tsx
@@ -98,6 +98,9 @@ type ReportActionItemImageProps = {
     /** Whether the receipt can be hover-zoomed. When true, remote PDFs render the actual PDF on top of the thumbnail so magnification stays sharp (web only). */
     canZoomReceipt?: boolean;
 
+    /** Resize mode for the receipt image */
+    resizeMode?: ReceiptImageProps['resizeMode'];
+
     /** Callback to be called when the image loads */
     onLoad?: (event?: {nativeEvent: {width: number; height: number}}) => void;
@@ -130,6 +133,7 @@ function ReportActionItemImage({
     report: reportProp,
     shouldUseThumbnailImage,
     canZoomReceipt = false,
+    resizeMode,
     onLoad,
     onLoadFailure,
 }: ReportActionItemImageProps) {
@@ -198,6 +202,7 @@ function ReportActionItemImage({
 
             // If the image is full height, use initial position to make sure it will grow properly to fill the container
             shouldUseInitialObjectPosition: isMapDistanceRequest && !shouldUseFullHeight,
+            resizeMode,
         };
     } else if (effectiveIsLocalFile && isPDF && typeof originalImageSource === 'string') {
         propsObj = {isPDFThumbnail: true, source: originalImageSource};
@@ -214,6 +219,7 @@ function ReportActionItemImage({
             // If the image is full height, use initial position to make sure it will grow properly to fill the container
             shouldUseInitialObjectPosition: isMapDistanceRequest && !shouldUseFullHeight,
             isEmptyReceipt,
+            resizeMode,
             onPress,
         };
     }

Pre-coded and tested in branch: fix/104138-receipt-preview-resize-mode (https://github.com/jloa-dev/App/tree/fix/104138-receipt-preview-resize-mode).

What alternative solutions did you explore? (Optional)

Expanding the preview container's height to match the receipt's native aspect ratio. However, long email receipts can be 3000px+ high, which would distort the expense details screen and push all expense fields far below the fold. Using contain within the standard preview bounds cleanly displays the entire receipt while preserving the layout.

jloa-dev avatar Oct 17 '26 16:10 jloa-dev

✅ Contributor details stored successfully. Thank you for contributing to Expensify!

melvin-bot[bot] avatar Oct 17 '26 16:10 melvin-bot[bot]

@sobitneupane Huh... This is 4 days overdue. Who can take care of this?

melvin-bot[bot] avatar Oct 20 '26 21:10 melvin-bot[bot]

@sobitneupane Still overdue 6 days?! Let's take care of this!

melvin-bot[bot] avatar Oct 22 '26 21:10 melvin-bot[bot]

I could not reproduce the issue.

I emailed receipt image to [email protected] and the image appeared as expected in the Expensify app.

@Getrudygidashang, am I missing any steps?

sobitneupane avatar Oct 26 '26 09:10 sobitneupane

@sobitneupane this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!

melvin-bot[bot] avatar Oct 29 '26 21:10 melvin-bot[bot]

@sobitneupane Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Oct 29 '26 21:10 melvin-bot[bot]

@sobitneupane 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Nov 02 '26 23:11 melvin-bot[bot]

@sobitneupane 6 days overdue. This is scarier than being forced to listen to Vogon poetry!

melvin-bot[bot] avatar Nov 03 '26 01:11 melvin-bot[bot]

@sobitneupane Still overdue 6 days?! Let's take care of this!

melvin-bot[bot] avatar Nov 03 '26 03:11 melvin-bot[bot]

I could not reproduce the issue.

I emailed receipt image to [email protected] and the image appeared as expected in the Expensify app.

@Getrudygidashang, am I missing any steps?

sobitneupane avatar Nov 03 '26 07:11 sobitneupane

@sobitneupane Whoops! This issue is 2 days overdue. Let's get this updated quick!

melvin-bot[bot] avatar Nov 06 '26 21:11 melvin-bot[bot]