-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[On Hold #44778] Submit Expense - Inconsistent Error Messages for Password Protected PDFs on Mweb and Android #44091
Comments
Triggered auto assignment to @CortneyOfstad ( |
@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 |
ProposalPlease 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
What changes do you think we should make in order to solve the problem?We should be using What alternative solutions did you explore? (Optional) |
ProposalPlease 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 App/src/components/MoneyRequestConfirmationList.tsx Lines 1237 to 1238 in f618a94
For web, we handle password protected pdf in App/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 App/src/pages/iou/request/step/IOURequestStepScan/index.tsx Lines 216 to 219 in f618a94
This will change web error message to Attachment error
What alternative solutions did you explore? (Optional)Change native platform error message to App/src/components/MoneyRequestConfirmationList.tsx Lines 1237 to 1238 in f618a94
This will change native platforms error message to Invalid file type
|
ProposalPlease 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
What alternative solutions did you explore? (Optional) |
@CortneyOfstad Huh... This is 4 days overdue. Who can take care of this? |
Sorry was OoO! I think this may be more BE (tied to design) so going to get confirmation! |
Asked here |
Bumped the thread in design again 👍 |
Alright, confirmed with the Design Team that we want |
Job added to Upwork: https://www.upwork.com/jobs/~01a71dc36f6e73ac8e |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt ( |
@Krishna2323 @etCoderDysto @cretadn22 Thank you for the proposals. The inconsistency we are having concerns both the error message being different as well as the timing of the verification phase (scan vs confirmation page). Can we add support to pdf verification on the scan step on native to be consist with web and then remove the one in the confirmation page? |
@Krishna2323 @etCoderDysto @cretadn22 bumps on the above ^^^^ thank you! |
Hi, @s77rt . We can't use isPdfFilePasswordProtected for iOS and Android since it uses pdfjsLib - a web support only library - to check if a pdf has password. We can create What should we do to detect if a pdf is password-protected using
|
fitPolicy={0} | |
trustAllCerts={false} | |
renderActivityIndicator={() => <FullScreenLoadingIndicator style={loadingIndicatorStyles} />} | |
source={{uri: sourceURL, cache: true, expiration: 864000}} | |
style={pdfStyles} | |
onError={handleFailureToLoadPDF} | |
password={password} | |
onLoadComplete={finishPDFLoad} |
- Check if the error is caused by a wrong password passed to a password-protected pdf on
onError
callback using the same logic used below
App/src/components/PDFView/index.native.tsx
Lines 79 to 80 in 0bfa295
const handleFailureToLoadPDF = ((error: Error) => { | |
if (error.message.match(/password/i)) { |
- Return true if the above condition holds to be true.
@s77rt any follow-up on the comment above? |
@CortneyOfstad I'm on it |
@etCoderDysto The |
I haven't tried that. I will try it and get back to you. |
@CortneyOfstad @s77rt this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks! |
Still waiting on proposals |
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸 |
@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 |
@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:
|
There is an exported |
@CortneyOfstad Let hold this on #44778 |
Sounds good — thanks @s77rt! |
Deployed to production! Going to close 🎉 |
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: 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:
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?
Screenshots/Videos
Add any screenshot/video evidence
Bug6519420_1718889532550.ju.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @s77rtThe text was updated successfully, but these errors were encountered: