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
[LOW] [Splits] [$500] Mweb/Chrome - Scan request created using corrupt pdf displays incorrect error message #34032
Version Number: 1.4.22 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs:https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: Applause - Internal Team Slack conversation:
changed the title [-]Mweb/Chrome - Scan request created using corrupt pdf displays incorrect error message[/-][+][$500] Mweb/Chrome - Scan request created using corrupt pdf displays incorrect error message[/+]on Jan 5, 2024
It relies entirely on the metadata, without checking content. So differences in how the mobile operating system interprets the metadata could lead to these corrupted PDFs getting through..
Please re-state the problem that we are trying to solve in this issue:
Corrupt pdfs can be uploaded as a receipt - and the error message is generic.
What is the root cause of that problem?
There's no specific pdf checking logic to determine whether the file is corrupted. Currently, we only check for size parameters and required extensions:
What changes do you think we should make in order to solve the problem?
Either install front-end checks (render the pdf using 'react-pdf' and 'react-native-pdf'), to check for file corruption. Or adjust the genericEditFailureMessage to be more meaningful in the case of corrupted pdf file.
Yes, I think tomorrow will be ready, today was reviewed internally, I will make adjustments and when approved internally I will open to external review
Hi I noticed on latest main that there is a bug that even when I am uploading pdf which is not corrupted I am getting error that file is corrupted and I think its related to this #40162 PR because of that I cant test newest changes
Activity
[-]Mweb/Chrome - Scan request created using corrupt pdf displays incorrect error message[/-][+][$500] Mweb/Chrome - Scan request created using corrupt pdf displays incorrect error message[/+]melvin-bot commentedon Jan 5, 2024
Job added to Upwork: https://www.upwork.com/jobs/~019826bd315885912e
melvin-bot commentedon Jan 5, 2024
Triggered auto assignment to @sonialiap (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.melvin-bot commentedon Jan 5, 2024
Bug0 Triage Checklist (Main S/O)
Platformsin OP are ✅)melvin-bot commentedon Jan 5, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @situchan (
External)codebycarlos commentedon Jan 5, 2024
I can't replicate this on my android mobile (I get the error post upload as expected). Could you please share the file?
I believe the receipt is validated here.
App/src/pages/iou/ReceiptSelector/index.js
Lines 102 to 120 in 393f2be
It relies entirely on the metadata, without checking content. So differences in how the mobile operating system interprets the metadata could lead to these corrupted PDFs getting through..
FlorianWueest commentedon Jan 5, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue:
Corrupt pdfs can be uploaded as a receipt - and the error message is generic.
What is the root cause of that problem?
There's no specific pdf checking logic to determine whether the file is corrupted. Currently, we only check for size parameters and required extensions:
We check it here:
App/src/pages/iou/ReceiptSelector/index.js
Lines 102 to 120 in fa533ce
With those parameters:
App/src/CONST.ts
Lines 51 to 60 in fa533ce
What changes do you think we should make in order to solve the problem?
Either install front-end checks (render the pdf using 'react-pdf' and 'react-native-pdf'), to check for file corruption. Or adjust the
genericEditFailureMessageto be more meaningful in the case of corrupted pdf file.samilabud commentedon Jan 6, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Mweb/Chrome - Scan request created using corrupt pdf displays incorrect error message
What is the root cause of that problem?
We are not checking if the PDF file is corrupted/valid file before uploading in the next components:
https://github.com/Expensify/App/blob/main/src/pages/iou/request/step/IOURequestStepScan/index.js
https://github.com/Expensify/App/blob/main/src/pages/iou/request/step/IOURequestStepScan/index.native.js
What changes do you think we should make in order to solve the problem?
We should validate the PDF before uploading the file in the previously mentioned files and show an error message if PDF is corrupted.
Based on our current PDF libraries:
App/src/components/PDFView/index.js
Line 6 in 0c351a4
Create a function to check the integrity of the file:
Then inside of validateReceipt functions:
Also, we should add this last strings to languages files like: https://github.com/Expensify/App/blob/main/src/languages/en.ts
eg:
This could be the result:
Valid.PDF.Files.in.Scan.-.test.mp4
Christinadobrzyn commentedon Jan 7, 2024
Hey @situchan could you check if this GH is a duplicate - thanks!
135 remaining items
kubabutkiewicz commentedon Apr 15, 2024
Yes, I think tomorrow will be ready, today was reviewed internally, I will make adjustments and when approved internally I will open to external review
kubabutkiewicz commentedon Apr 16, 2024
Hi I noticed on latest main that there is a bug that even when I am uploading pdf which is not corrupted I am getting error that file is corrupted and I think its related to this #40162 PR because of that I cant test newest changes
melvin-bot commentedon Apr 16, 2024
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
rushatgabhane commentedon Apr 18, 2024
thank you for finding the cause. let's hold on #40471 (review)
paultsimura commentedon Apr 19, 2024
@rushatgabhane you shouldn't hold for #40471 – the mentioned issue was fixed in #40351, which is already merged.
@kubabutkiewicz please retry with the latest main.
kubabutkiewicz commentedon Apr 26, 2024
Hi, just wanted to inform that I will be OOO from 29.04 to 05.05.
mvtglobally commentedon May 1, 2024
Issue not reproducible during KI retests. (First week)
luacmartins commentedon May 1, 2024
Seems like #40471 (review) may have fixed the issue. Gonna close it since it's no longer reproducible. Please reopen if this is still happening.