Skip to content

Expense - Wrong attachment size limit is shown when uploading from add receipt button #85953

Closed

Description

@nlemma

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: 9.3.41-3
Reproducible in staging?: Yes
Reproducible in production?: N/A - new feature, doesn't exist in prod
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #84497
Email or phone of affected tester (no customers): sdhsiudhishisdihsd@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Add an attachment larger than 25 MB.
    → Error modal shows "Attachment size is larger than 24 MB limit".
  4. Create an expense with receipt.
  5. Open the expense.
  6. Hover over the receipt.
  7. Click Add button.
  8. Add an attachment larger than 25 MB.
    → Error modal shows "Attachment size is larger than 10 MB limit".

Expected Result:

When adding large attachment from add additional receipt button, error modal should display "Attachment size is larger than 24 MB limit".

Actual Result:

When adding large attachment from add additional receipt button, error modal shows "Attachment size is larger than 10 MB limit".
Attachment larger than 10 MB can be uploaded without error.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug7108281_1774013725198.13.mp4

Bug7108281_1774015562122!20MB-TESTFILE.ORG.pdf

View all open jobs on GitHub

Issue OwnerCurrent Issue Owner: @TaduJR

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    on Mar 20, 2026
  2. melvin-bot commented on Mar 20, 2026

    @melvin-bot

    @puneetlath recently merged #84497, but they are OOO right now, so I'll auto-assign someone else.

  3. melvin-bot commented on Mar 20, 2026

    @melvin-bot

    Triggered auto assignment to @youssef-lr (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  4. github-actions commented on Mar 20, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  5. melvin-bot commented on Mar 20, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  6. MelvinBot commented on Mar 20, 2026

    @MelvinBot
    Contributor

    Proposal

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

    When adding a large attachment via the "Add additional receipt" button on an expense's receipt view, the error modal incorrectly shows "Attachment size is larger than 10 MB limit" instead of "Attachment size is larger than 24 MB limit". Files between 10-24 MB are rejected from this button but accepted from the normal attachment flow.

    What is the root cause of that problem?

    In MoneyRequestReceiptView.tsx, the "Add additional receipt" button calls validateFiles(files) at line 538 without passing validationOptions.

    The useFilesValidation hook defaults isValidatingReceipts to true (line 20 and line 293). When isValidatingReceipts is true, validation uses CONST.API_ATTACHMENT_VALIDATIONS.RECEIPT_MAX_SIZE (10 MB) instead of CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE (24 MB) — see validateAttachmentFile.ts line 33.

    However, the "Add additional receipt" button doesn't replace the transaction's receipt — it adds a regular report attachment via addAttachmentWithComment (line 198). This is the same flow as the composer's attachment upload, which correctly passes {isValidatingReceipts: false} at useAttachmentUploadValidation.ts line 180 and uses the 24 MB limit.

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

    In MoneyRequestReceiptView.tsx, pass {isValidatingReceipts: false} when calling validateFiles from the "Add additional receipt" button, since the files are being added as regular report attachments (not transaction receipts):

    Change validateFiles(files) to validateFiles(files, undefined, {isValidatingReceipts: false}) at line 538.

    What alternative solutions did you explore? (Optional)

    We could change DEFAULT_IS_VALIDATING_RECEIPTS in useFilesValidation.tsx from true to false, but that would affect all callers that currently rely on the default receipt validation behavior (e.g., the scan step, odometer image, share page). The targeted fix is safer.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. OSBotify commented on Mar 20, 2026

    @OSBotify
    Contributor

    🔍 Investigation Summary

    Classification: Frontend bug
    Causing PR: #84497 - "fix: resolve deploy blockers and add hover/tooltip to receipt action buttons" by @TaduJR (High confidence)
    Related Issues: #84356 (the original issue this PR was fixing)

    Recommendation: ROLL FORWARD

    PR #84497 introduced file validation to the "Add additional receipt" button, but used the wrong validation mode. The fix is simple and low-risk: change one line to pass the correct validation options.

    Fix needed: In src/components/ReportActionItem/MoneyRequestReceiptView.tsx line 538, change:

    validateFiles(files);

    to:

    validateFiles(files, undefined, {isValidatingReceipts: false});

    This will correctly apply the 24MB limit instead of the 10MB limit for additional receipts.

    Labels: No label changes needed - this is a frontend bug, so DeployBlockerCash should remain.

    📋 Detailed Analysis

    Evidence

    PR #84497 added the useFilesValidation hook to MoneyRequestReceiptView.tsx to validate files before uploading them as additional receipts. However, when calling validateFiles(files) without options, it defaults to isValidatingReceipts: true.

    The validation flow:

    1. validateFiles(files) is called without validationOptions parameter (line 538 of MoneyRequestReceiptView.tsx)
    2. This defaults to isValidatingReceipts: DEFAULT_IS_VALIDATING_RECEIPTS which is true (useFilesValidation.tsx line 20)
    3. When isValidatingReceipts: true, the validation uses CONST.API_ATTACHMENT_VALIDATIONS.RECEIPT_MAX_SIZE which is 10MB
    4. When isValidatingReceipts: false, the validation uses CONST.API_ATTACHMENT_VALIDATIONS.MAX_SIZE which is 24MB

    Verification

    Files affected:

    • src/components/ReportActionItem/MoneyRequestReceiptView.tsx - where the bug occurs
    • src/hooks/useFilesValidation.tsx - contains the default behavior
    • src/libs/validateAttachmentFile.ts - determines which size limit to use based on isValidatingReceipts

    Confirmed the PR modifies these files: ✓ Yes, PR #84497 modified MoneyRequestReceiptView.tsx and added the validation logic

    Alignment with timeline: ✓ Yes, the issue states this is reproducible in staging (v9.3.41-3), and PR #84497 was merged on 2026-03-18 and is included in the StagingDeployCash checklist

    Root Cause

    The useFilesValidation hook has two modes:

    • isValidatingReceipts: true - applies 10MB limit (for receipt uploads via expense creation)
    • isValidatingReceipts: false - applies 24MB limit (for general attachments)

    The "add additional receipt" feature should use the 24MB limit (same as workspace chat attachments), but the code defaults to the 10MB limit. This creates an inconsistent user experience where:

    • Adding attachment from workspace chat: "24 MB limit" ✓ correct
    • Adding additional receipt to existing expense: "10 MB limit" ✗ incorrect

    The constants clearly show the intended limits:

    // From src/CONST/index.ts
    MAX_SIZE: 25165824,        // 24 MB - for general attachments
    RECEIPT_MAX_SIZE: 10485760, // 10 MB - for initial receipt upload

    Additional receipts should use the general attachment limit (24MB), not the initial receipt limit (10MB).

  8. cristipaval commented on Mar 20, 2026

    @cristipaval
    Contributor

    Demoting this one

  9. TaduJR commented on Mar 20, 2026

    @TaduJR
    Contributor

    Investigating...

    Assignment here @cristipaval

    Thanks!

  10. TaduJR commented on Mar 20, 2026

    @TaduJR
    Contributor

    @cristipaval

    It seems the issue is also repo on Add Attachment from this comment #85951 (comment)

    @dukenv0307 Can you confirm #85951 and this issue are interrelated?

  11. TaduJR commented on Mar 23, 2026

    @TaduJR
    Contributor

    @puneetlath

    Can we close this one?

    It's being handled here #85951

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

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.DailyKSv2Engineering

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions