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
[On Hold #44778] Submit Expense - Inconsistent Error Messages for Password Protected PDFs on Mweb and Android #44091
Version Number: 1.4.86-0 Reproducible in staging?: Y Reproducible in production?: Y If this was caught during regression testing, add the test name, ID and link from TestRail: N/A Email or phone of affected tester (no customers):abebemiherat@gmail.com Issue reported by: Applause - Internal Team
Action Performed:
On Android: Sign in with Expensify > FAB > Submit Expense
Add an amount and attach a password-protected PDF
On Mweb: Repeat the above steps
Observe the error messages
Expected Result:
The error message should be consistent for the same password-protected PDF across both platforms
Actual Result:
Different error messages appear for password-protected PDFs on Mweb and Android
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
@CortneyOfstad FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Please re-state the problem that we are trying to solve in this issue.
Inconsistent Error Messages for Password Protected PDFs on Mweb and Android
What is the root cause of that problem?
The root cause is that we are handling errors concerning password protected pdf files for native apps in MoneyRequestConfirmationList. That is because password protected pdf error is not caught by the validation put in IOURequestStepScan for native devices. Hence 'Attachment error' message is displayed because of the default error key attachmentPicker.attachmentError put in MoneyRequestConfirmationList
However, the isPdfFilePasswordProtected function only operates on the web platform (it is not defined for native). Therefore, if we upload a password-protected PDF file on the native platform, the Scan page will not generate an error. Instead, the error message occurs on the confirmation page on the native
What changes do you think we should make in order to solve the problem?
Fortunately, we can determine whether the PDF file requires a password by utilizing the onPassword callback of the PDFThumbnail Component on the confirmation page
@s77rt, thank you for your suggestion. Currently, we're using react-native-pdf to detect if a PDF file requires a password in our native setup. However, this method requires rendering the PDF file using the PDF component from react-native-pdf. Upon further investigation into react-native-pdf, I found that it doesn't offer a direct API specifically for checking password protection.
We have two potential solutions:
Integrate another library that handles PDF password detection.
Extend react-native-pdf by implementing native code for both Android and iOS.
Personally, neither of these methods seems justified for addressing such a minor issue. My proposal seems like a workaround, but it effectively resolves the issue without making significant alterations
@cretadn22 Your proposal will only change the text error but still keep the inconsistency where on web the validation is done on the scan page while on native it's done on the confirmation page.
I would prefer doing one of the following:
Make the pdfjs library work on native (only for checking if the pdf is password protected and not rendering)
changed the title [-][$250] Submit Expense - Inconsistent Error Messages for Password Protected PDFs on Mweb and Android[/-][+][On Hold #44778] Submit Expense - Inconsistent Error Messages for Password Protected PDFs on Mweb and Android[/+]on Jul 9, 2024
Activity
melvin-bot commentedon Jun 20, 2024
Triggered auto assignment to @CortneyOfstad (
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.lanitochka17 commentedon Jun 20, 2024
@CortneyOfstad FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors
Krishna2323 commentedon Jun 20, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Submit Expense - Inconsistent Error Messages for Password Protected PDFs on Mweb and Android
What is the root cause of that problem?
The error title is wrong
attachmentPicker.wrongFileType.App/src/pages/iou/request/step/IOURequestStepScan/index.tsx
Line 219 in f618a94
What changes do you think we should make in order to solve the problem?
We should be using
attachmentPicker.attachmentError.What alternative solutions did you explore? (Optional)
etCoderDysto commentedon Jun 20, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Inconsistent Error Messages for Password Protected PDFs on Mweb and Android
What is the root cause of that problem?
The root cause is that we are handling errors concerning password protected pdf files for native apps in MoneyRequestConfirmationList. That is because password protected pdf error is not caught by the validation put in IOURequestStepScan for native devices. Hence 'Attachment error' message is displayed because of the default error key
attachmentPicker.attachmentErrorput inMoneyRequestConfirmationListApp/src/components/MoneyRequestConfirmationList.tsx
Lines 1237 to 1238 in f618a94
For web, we handle password protected pdf in
IOURequestStepScan.indexApp/src/pages/iou/request/step/IOURequestStepScan/index.tsx
Lines 216 to 219 in f618a94
What changes do you think we should make in order to solve the problem?
Change web error message key to
attachmentPicker.attachmentErrorinIOURequestStepScan.indexApp/src/pages/iou/request/step/IOURequestStepScan/index.tsx
Lines 216 to 219 in f618a94
This will change web error message to
Attachment errorWhat alternative solutions did you explore? (Optional)
Change native platform error message to
attachmentPicker.wrongFileTypeinMoneyRequestConfirmationListApp/src/components/MoneyRequestConfirmationList.tsx
Lines 1237 to 1238 in f618a94
This will change native platforms error message to
Invalid file typecretadn22 commentedon Jun 20, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
Error Messages for Password Protected PDFs on Android is incorrect
What is the root cause of that problem?
On web (only web), we implemented a check to identify Password Protected PDF files and show the correct error message
App/src/pages/iou/request/step/IOURequestStepScan/index.tsx
Lines 216 to 220 in 5bccd00
However, the isPdfFilePasswordProtected function only operates on the web platform (it is not defined for native). Therefore, if we upload a password-protected PDF file on the native platform, the Scan page will not generate an error. Instead, the error message occurs on the confirmation page on the native
What changes do you think we should make in order to solve the problem?
Fortunately, we can determine whether the PDF file requires a password by utilizing the onPassword callback of the PDFThumbnail Component on the confirmation page
App/src/components/MoneyRequestConfirmationList.tsx
Line 1129 in 5bccd00
App/src/components/MoneyRequestConfirmationList.tsx
Line 1133 in 5bccd00
App/src/components/MoneyRequestConfirmationList.tsx
Line 1238 in 5bccd00
What alternative solutions did you explore? (Optional)
melvin-bot commentedon Jun 25, 2024
@CortneyOfstad Huh... This is 4 days overdue. Who can take care of this?
CortneyOfstad commentedon Jun 25, 2024
Sorry was OoO!
I think this may be more BE (tied to design) so going to get confirmation!
CortneyOfstad commentedon Jun 25, 2024
Asked here
CortneyOfstad commentedon Jun 28, 2024
Bumped the thread in design again 👍
18 remaining items
s77rt commentedon Jul 4, 2024
Still waiting on proposals
melvin-bot commentedon Jul 5, 2024
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
cretadn22 commentedon Jul 5, 2024
@s77rt, thank you for your suggestion. Currently, we're using react-native-pdf to detect if a PDF file requires a password in our native setup. However, this method requires rendering the PDF file using the PDF component from react-native-pdf. Upon further investigation into react-native-pdf, I found that it doesn't offer a direct API specifically for checking password protection.
We have two potential solutions:
Personally, neither of these methods seems justified for addressing such a minor issue. My proposal seems like a workaround, but it effectively resolves the issue without making significant alterations
s77rt commentedon Jul 6, 2024
@cretadn22 Your proposal will only change the text error but still keep the inconsistency where on web the validation is done on the scan page while on native it's done on the confirmation page.
I would prefer doing one of the following:
s77rt commentedon Jul 6, 2024
@cretadn22
There is an exported
PdfManagerthat we can use to load the file without rendering.Krishna2323 commentedon Jul 6, 2024
@s77rt, sorry for delay on this, we are already handling PDF validation here. I think we can close this out.
s77rt commentedon Jul 7, 2024
@CortneyOfstad Let hold this on #44778
CortneyOfstad commentedon Jul 9, 2024
Sounds good — thanks @s77rt!
[-][$250] Submit Expense - Inconsistent Error Messages for Password Protected PDFs on Mweb and Android[/-][+][On Hold #44778] Submit Expense - Inconsistent Error Messages for Password Protected PDFs on Mweb and Android[/+]CortneyOfstad commentedon Jul 31, 2024
Deployed to production! Going to close 🎉