Fix PDF receipts not loading when receipt.source is missing#81950
Fix PDF receipts not loading when receipt.source is missing#81950MelvinBot wants to merge 1 commit into
Conversation
…ssing When receipts are added via email or billing, the backend sometimes provides receipt.filename without receipt.source. This causes the receipt viewer to receive a blank URL, leaving PDF previews empty. Apply the same fallback used in MergeTransactionUtils directly in getThumbnailAndImageURIs so all receipt display paths benefit: construct the URL as https://www.expensify.com/receipts/{filename} when source is missing but filename exists. Co-authored-by: Jan Nowakowski <jnowakow@users.noreply.github.com>
|
I created this PR from an upstream branch since I don't have push access to your fork. To take ownership of this branch and be able to push updates, run: Then you can close this PR and open a new one from your fork. |
|
The only failing check is This is not a code issue. The To fix this: Edit the PR description and check off (or remove) the remaining unchecked checklist items. For items that don't apply to this PR (e.g. new CSS styles, new assets, deeplinks, Storybook stories, UI changes), you can check them off as N/A since they aren't relevant to this single-file change in All other checks (ESLint, Prettier, builds, |
|
I'm closing in favour of #81960 |
Explanation of Change
When receipts are added via email forwarding or Expensify billing, the backend sometimes provides
receipt.filenamewithout populatingreceipt.source. ThegetThumbnailAndImageURIsfunction inReceiptUtils.tsreturns an empty string for the image path whensourceis missing, causing the PDF viewer to receive a blank URL and display nothing.This fix adds a fallback in
getThumbnailAndImageURIs: whenreceipt.sourceis missing butreceipt.filenameexists, construct the URL ashttps://www.expensify.com/receipts/{filename}. This is the same workaround already used inMergeTransactionUtils.ts:fillMissingReceiptSource, but applied at the general receipt utility level so all receipt display paths (not just merge) benefit from it.Fixed Issues
$ #78846
Tests
receipt.sourceis missing butreceipt.filenameexists)receipt.sourceis present)Offline tests
QA Steps
receipt.sourceis missingPR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari