You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2025-11-07] [Due for payment 2025-10-30] [$250] Expense - Scan expense with video as receipt can be created by dropping video to Scan zone #72402
Drag and drop a video to the Scan RHP
→ Invalid file type error shows up - Expected behavior
Close the RHP
Drag and drop a video to Scan zone
Click Create expense
Open the expense thread
Expected Result:
"Invalid file type" error will show up when dropping a video to Scan zone in workspace chat
Actual Result:
User can create a scan expense with video as receipt by dropping a video to Scan zone in workspace chat
There is no "Invalid file type" error
After creating the expense, error shows up in transaction thread
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
Windows: Chrome
MacOS: Chrome / Safari
MacOS: Desktop
Platforms Tested:
On which of our officially supported platforms was this issue tested:
Android: App
Android: mWeb Chrome
iOS: App
iOS: mWeb Safari
iOS: mWeb Chrome
Windows: Chrome
MacOS: Chrome / Safari
MacOS: Desktop
Screenshots/Videos
Add any screenshot/video evidenceBug6972307_1760211709021.video_receipt.mp4
🚨 Edited by proposal-police: This proposal was edited at 2025-10-13 07:13:05 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user drags and drops a video file to the Scan zone in a workspace chat, the video is accepted and can be used to create a scan expense. However, videos are not allowed as receipt types. The expected behavior is that an "Invalid file type" error should appear when dropping a video to the Scan zone, similar to what happens when dropping a video in the Scan RHP (Right Hand Panel).
What is the root cause of that problem?
The root cause is that the useFilesValidation hook is initialized with the wrong isValidatingReceipts parameter value in useAttachmentUploadValidation.
The ALLOWED_RECEIPT_EXTENSIONS array does not include video formats like 'mp4', 'mov', 'avi', etc.
What changes do you think we should make in order to solve the problem?
We need to use two separate instances of the useFilesValidation hook:
One for attachments with isValidatingReceipts = false
One for receipts with isValidatingReceipts = true
This follows the hook's intended design pattern where isValidatingReceipts is a configuration parameter set at initialization, not a runtime parameter.
// Combine PDF validation components from both hooksconstcombinedPDFValidationComponent=useMemo(()=>{constcomponents=[];if(AttachmentPDFValidationComponent){components.push(...(Array.isArray(AttachmentPDFValidationComponent) ? AttachmentPDFValidationComponent : [AttachmentPDFValidationComponent]));}if(ReceiptPDFValidationComponent){components.push(...(Array.isArray(ReceiptPDFValidationComponent) ? ReceiptPDFValidationComponent : [ReceiptPDFValidationComponent]));}returncomponents.length>0 ? components : undefined;},[AttachmentPDFValidationComponent,ReceiptPDFValidationComponent]);// Use receipt error modal by default, fall back to attachment error modalconstcombinedErrorModal=useMemo(()=>ReceiptErrorModal??AttachmentErrorModal,[AttachmentErrorModal,ReceiptErrorModal]);return{
validateAttachments,
onReceiptDropped,PDFValidationComponent: combinedPDFValidationComponent,ErrorModal: combinedErrorModal,};
it performs standard file validation instead of the stricter validation required for receipts, allowing unsupported file types like videos.
What changes do you think we should make in order to solve the problem?
We should correctly pass the newly introduced isValidatingReceipts parameter through the validation chain to ensure receipt files are properly validated.
Update the function calls in the following lines to include the isValidatingReceipts argument:
changed the title [-]Expense - Scan expense with video as receipt can be created by dropping video to Scan zone[/-][+][$250] Expense - Scan expense with video as receipt can be created by dropping video to Scan zone[/+]on Oct 13, 2025
The issue is that we are using the same function validateFiles for validating both receipts and attachments but at the time of hook instialiazation we are passing the value of false to isValidatingReceipts for the hook and after that if we have receipt file as well, it will be passed through the validation logic of attachment and not receipt. And for attachments video files are allowed, so it allows the video files to pass through the validation.
What changes do you think we should make in order to solve the problem?
We can add a extra optional parameter isValidatingReceiptFiles to the function validateFiles, so that whenever we need to validate receipts, we can check value of the optional parameter first and also we can have a fallback to the default value of the hook parameter which is used during initialization, if the optional parameter is not passed. We need to pass this optional parameter through the chain of functions to finally reach to validateAttachment function where the logic to validate receipts and attachments is finally handled.
We need to add the following changes at the following places:
What alternative solutions did you explore? (Optional)
We could use two hook initialisations one for validating reciepts and one for attachments but i don't think that will be a good practice. Note for C+ @parasharrajat : Since there are lot of small changes, i have already added my changes to my local branch for testing.
Local branch for testing: https://github.com/Burhan-Rashid/App/tree/fix/72402
Local PR for viewing the diff properly: https://github.com/Burhan-Rashid/App/pull/1/files Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
Since this was a regression and both contributor and C+ from the original issue did the fix, no payment is required here. @parasharrajat does that sound right to you?
@kadiealexander, This was handled outside the regression period and exported, so it should be eligible for payment. The PR that caused this is part of a major refactoring, and multiple PRs have been created on that task, so I expect this to be eligible for payment.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: Not needed
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
changed the title [-][Due for payment 2025-10-30] [$250] Expense - Scan expense with video as receipt can be created by dropping video to Scan zone[/-][+][Due for payment 2025-11-07] [Due for payment 2025-10-30] [$250] Expense - Scan expense with video as receipt can be created by dropping video to Scan zone[/+]on Oct 31, 2025
Activity
melvin-bot commentedon Oct 12, 2025
Triggered auto assignment to @kadiealexander (
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.TaduJR commentedon Oct 12, 2025
🚨 Edited by proposal-police: This proposal was edited at 2025-10-13 07:13:05 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a user drags and drops a video file to the Scan zone in a workspace chat, the video is accepted and can be used to create a scan expense. However, videos are not allowed as receipt types. The expected behavior is that an "Invalid file type" error should appear when dropping a video to the Scan zone, similar to what happens when dropping a video in the Scan RHP (Right Hand Panel).
What is the root cause of that problem?
The root cause is that the
useFilesValidationhook is initialized with the wrongisValidatingReceiptsparameter value inuseAttachmentUploadValidation.The issue occurs in this file:
App/src/pages/home/report/ReportActionCompose/useAttachmentUploadValidation.ts
Line 119 in 89c45c9
The hook is initialized with
isValidatingReceipts = false:This single hook instance is then used for both:
false)true)Why this causes the bug:
When
isValidatingReceipts = falseis passed touseFilesValidation, the validation flow becomes:validateFilesis called with the video fileisValidFile:App/src/hooks/useFilesValidation.tsx
Line 118 in 89c45c9
validateAttachmentwithisValidatingReceipts = false:App/src/libs/fileDownload/FileUtils.ts
Lines 550 to 566 in 89c45c9
isValidatingReceiptisfalse:App/src/libs/fileDownload/FileUtils.ts
Lines 553 to 555 in 89c45c9
Since the check is skipped, video files pass validation and are allowed to create expenses.
In contrast, the Scan RHP works correctly:
App/src/pages/iou/request/step/IOURequestStepScan/index.tsx
Line 650 in 89c45c9
The hook is called with
isValidatingReceipts = true(the default), so videos are properly rejected.Video extensions are NOT in the allowed list:
App/src/CONST/index.ts
Line 264 in 89c45c9
The
ALLOWED_RECEIPT_EXTENSIONSarray does not include video formats like 'mp4', 'mov', 'avi', etc.What changes do you think we should make in order to solve the problem?
We need to use two separate instances of the
useFilesValidationhook:isValidatingReceipts = falseisValidatingReceipts = trueThis follows the hook's intended design pattern where
isValidatingReceiptsis a configuration parameter set at initialization, not a runtime parameter.Changes needed in:
https://github.com/Expensify/App/blob/89c45c98a802b6d039a6d36d7afc761083e89212/src/pages/home/report/ReportActionCompose/useAttachmentUploadValidation.ts
Step 1: Add
useMemoto imports (line 1):Step 2: Split the unified
onFilesValidatedcallback into two separate callbacks (replace lines 70-117):Step 3: Replace the single hook instance with two separate instances (replace line 119):
Step 4: Update
validateAttachmentsto use the attachment-specific validation (line 164):Replace:
With:
And update the dependency array (line 166):
Step 5: Update
onReceiptDroppedto use the receipt-specific validation (replace lines 179-191):Replace:
With:
And update the dependency array (line 192):
Step 6: Remove the
attachmentUploadTyperef (line 70) - it's no longer needed:Delete:
Step 7: Combine the validation components from both hooks (replace lines 195-200):
Replace:
With:
paulnjs commentedon Oct 13, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
The issue originates from how we validate files in
ReportActionComposeusing thevalidateAttachmentsfunction:App/src/pages/home/report/ReportActionCompose/ReportActionCompose.tsx
Line 483 in 89c45c9
This function comes from:
App/src/pages/home/report/ReportActionCompose/useAttachmentUploadValidation.ts
Line 119 in 89c45c9
In the above implementation, the
isValidatingReceiptsparameter is incorrectly passed asfalse, even when the file is being validated as a receipt.As a result, when the
validateFilesfunction is called:App/src/pages/home/report/ReportActionCompose/useAttachmentUploadValidation.ts
Line 186 in 89c45c9
App/src/pages/home/report/ReportActionCompose/useAttachmentUploadValidation.ts
Line 190 in 89c45c9
it performs standard file validation instead of the stricter validation required for receipts, allowing unsupported file types like videos.
What changes do you think we should make in order to solve the problem?
We should correctly pass the newly introduced
isValidatingReceiptsparameter through the validation chain to ensure receipt files are properly validated.Update the function calls in the following lines to include the
isValidatingReceiptsargument:App/src/pages/home/report/ReportActionCompose/useAttachmentUploadValidation.ts
Line 186 in 89c45c9
App/src/pages/home/report/ReportActionCompose/useAttachmentUploadValidation.ts
Line 190 in 89c45c9
App/src/hooks/useFilesValidation.tsx
Line 279 in 89c45c9
, then pass down to
App/src/hooks/useFilesValidation.tsx
Line 191 in 89c45c9
App/src/hooks/useFilesValidation.tsx
Line 117 in 89c45c9
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
NA
What alternative solutions did you explore? (Optional)
[-]Expense - Scan expense with video as receipt can be created by dropping video to Scan zone[/-][+][$250] Expense - Scan expense with video as receipt can be created by dropping video to Scan zone[/+]melvin-bot commentedon Oct 13, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021977603641386532131
melvin-bot commentedon Oct 13, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (
External)Burhan-Rashid commentedon Oct 14, 2025
Proposal
Please re-state the problem that we are trying to solve in this issue.
Expense - Scan expense with video as receipt can be created by dropping video to Scan zone
What is the root cause of that problem?
We have recently updated the default value of the hook to not validate receipts by default here:
852b073
App/src/pages/home/report/ReportActionCompose/useAttachmentUploadValidation.ts
Line 119 in 276a46a
The issue is that we are using the same function validateFiles for validating both receipts and attachments but at the time of hook instialiazation we are passing the value of false to isValidatingReceipts for the hook and after that if we have receipt file as well, it will be passed through the validation logic of attachment and not receipt. And for attachments video files are allowed, so it allows the video files to pass through the validation.
What changes do you think we should make in order to solve the problem?
We can add a extra optional parameter isValidatingReceiptFiles to the function validateFiles, so that whenever we need to validate receipts, we can check value of the optional parameter first and also we can have a fallback to the default value of the hook parameter which is used during initialization, if the optional parameter is not passed. We need to pass this optional parameter through the chain of functions to finally reach to validateAttachment function where the logic to validate receipts and attachments is finally handled.
We need to add the following changes at the following places:
App/src/hooks/useFilesValidation.tsx
Line 268 in 276a46a
App/src/hooks/useFilesValidation.tsx
Line 279 in 276a46a
App/src/hooks/useFilesValidation.tsx
Line 178 in 276a46a
App/src/hooks/useFilesValidation.tsx
Line 191 in 276a46a
App/src/hooks/useFilesValidation.tsx
Line 104 in 276a46a
And here we need to use initial hook value as fallback i.e isValidatingReceipts
App/src/hooks/useFilesValidation.tsx
Line 117 in 276a46a
And finally pass it true whereever we are validating receipts files:
App/src/pages/home/report/ReportActionCompose/useAttachmentUploadValidation.ts
Line 186 in 276a46a
App/src/pages/home/report/ReportActionCompose/useAttachmentUploadValidation.ts
Line 190 in 276a46a
What alternative solutions did you explore? (Optional)
We could use two hook initialisations one for validating reciepts and one for attachments but i don't think that will be a good practice.
Note for C+ @parasharrajat : Since there are lot of small changes, i have already added my changes to my local branch for testing.
Local branch for testing: https://github.com/Burhan-Rashid/App/tree/fix/72402
Local PR for viewing the diff properly: https://github.com/Burhan-Rashid/App/pull/1/files
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
26 remaining items
kadiealexander commentedon Oct 30, 2025
Since this was a regression and both contributor and C+ from the original issue did the fix, no payment is required here. @parasharrajat does that sound right to you?
parasharrajat commentedon Oct 30, 2025
@kadiealexander, This was handled outside the regression period and exported, so it should be eligible for payment. The PR that caused this is part of a major refactoring, and multiple PRs have been created on that task, so I expect this to be eligible for payment.
kadiealexander commentedon Oct 31, 2025
@parasharrajat sounds good, could you please complete the checklist?
parasharrajat commentedon Oct 31, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: refactor: Migrate "Add Attachment" flows to
AttachmentModalScreen#69523[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: Not needed
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/566446
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
[-][Due for payment 2025-10-30] [$250] Expense - Scan expense with video as receipt can be created by dropping video to Scan zone[/-][+][Due for payment 2025-11-07] [Due for payment 2025-10-30] [$250] Expense - Scan expense with video as receipt can be created by dropping video to Scan zone[/+]melvin-bot commentedon Nov 7, 2025
Payment Summary
Upwork Job
BugZero Checklist (@kadiealexander)
parasharrajat commentedon Nov 10, 2025
Payment requested as per #72402 (comment)
trjExpensify commentedon Nov 17, 2025
approved $250 for @parasharrajat.