Skip to content
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

[HOLD for payment 2024-02-14] [$500] Android-Attachments-App crashes on uploading specific PDF #29743

Closed
1 of 6 tasks
izarutskaya opened this issue Oct 17, 2023 · 90 comments · Fixed by wonday/react-native-pdf#791
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff

Comments

@izarutskaya
Copy link

izarutskaya commented Oct 17, 2023

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.3.85-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:
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: @

Action Performed:

  1. Launch app
  2. Tap on a report
  3. Tap plus icon near compose
  4. Tap Add attachments
  5. Tap Choose document
  6. Select the below attached PDF

Expected Result:

User must be able to upload all pdf and app must not crash while trying to upload any pdf.

Actual Result:

When user tries to upload specific pdf app crashes.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Android: Native
Bug6239948_1697510744742.pdf_compress_1.mp4

utest-dl.s3.amazonaws.com_12102_26469_432782_6239948_bugAttachment_Bug6239948_1697510571673%21pdf_rash.txt_X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20231017T095403Z&X-Amz-SignedHeaders=host&X-Amz-Expires=86400&X-Amz-Credential=AK.txt

class-9-maths-chapter-10-solutions.pdf

Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01f2fe87b1c515e0af
  • Upwork Job ID: 1714218588456812544
  • Last Price Increase: 2023-11-07
Issue OwnerCurrent Issue Owner: @abekkala
@izarutskaya izarutskaya added External Added to denote the issue can be worked on by a contributor Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Oct 17, 2023
@melvin-bot melvin-bot bot changed the title Android-Attachments-App crashes on uploading specific PDF [$500] Android-Attachments-App crashes on uploading specific PDF Oct 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

Triggered auto assignment to @abekkala (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01f2fe87b1c515e0af

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Oct 17, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

Bug0 Triage Checklist (Main S/O)

  • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
  • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
    • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
  • This bug is reproducible using the reproduction steps in the OP. S/O
    • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
    • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
  • This issue is filled out as thoroughly and clearly as possible
    • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
  • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync

@melvin-bot
Copy link

melvin-bot bot commented Oct 17, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @thesahindia (External)

@pradeepmdk
Copy link
Contributor

pradeepmdk commented Oct 17, 2023

Proposal

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

Android-Attachments-App crashes on uploading specific (contains formula. Maths Symbols) PDF

What is the root cause of that problem?

this bug from react-native-pdf
https://github.com/wonday/react-native-pdf/blob/b700b0a2f27b29728dcc9665289e6e628a669f56/index.js#L361
whenever pdf upload onchange will be trigger at the time we are getting message as string so they spliting the message. so in when [0] position coming as a loadComplete at the time it will trigger onLoadComplete with 4 the param as a tablecontent of pdf message[4]&&JSON.parse(message[4])
here when we parse json its throws the error because above pdf has maths logic so that contains json string (unstructured format ) like this
Screenshot 2023-10-17 at 5 54 07 PM

https://github.com/wonday/react-native-pdf/blob/b700b0a2f27b29728dcc9665289e6e628a669f56/index.js#L374

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

we need to fix this upstream or patch fix using the below options

Option 1 )

add try-catch like

let tableContents;
                try {
                    tableContents = message[4]&&JSON.parse(message[4])
                } catch (e) { 
                    console.error(e);
                }
                this.props.onLoadComplete && this.props.onLoadComplete(Number(message[1]), this.state.path, {
                    width: Number(message[2]),
                    height: Number(message[3]),
                }, tableContents
                );

Options 2)

onLoadComplete={this.finishPDFLoad}

we are not using tableContents so maybe we can remove this option in the patch fix

 if (message[0] === 'loadComplete') {
                this.props.onLoadComplete && this.props.onLoadComplete(Number(message[1]), this.state.path, {
                    width: Number(message[2]),
                    height: Number(message[3]),
                });
            } 

Options 3)

instead of parsing in react-native-pdf we can pass string and parse from in our app (but currently we are not using this 4th param)

this.props.onLoadComplete && this.props.onLoadComplete(Number(message[1]), this.state.path, {
                    width: Number(message[2]),
                    height: Number(message[3]),
                },
                message[4]);

@thesahindia
Copy link
Member

I am busy with other tasks so gonna unassign.

cc: @abekkala

@thesahindia thesahindia removed their assignment Oct 19, 2023
@abekkala abekkala added External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor labels Oct 19, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 19, 2023

Triggered auto assignment to Contributor-plus team member for initial proposal review - @fedirjh (External)

@abekkala
Copy link
Contributor

@fedirjh Can you review the proposal that has been submitted for this? thanks!

@melvin-bot melvin-bot bot added the Overdue label Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 23, 2023

@abekkala, @fedirjh Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@fedirjh
Copy link
Contributor

fedirjh commented Oct 23, 2023

@pradeepmdk Can you please elaborate more on the root cause and how to fix it? can you please explain your preposed solution?

@melvin-bot melvin-bot bot removed the Overdue label Oct 23, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 24, 2023

📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

@melvin-bot melvin-bot bot added the Overdue label Oct 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 26, 2023

@abekkala, @fedirjh Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!

@fedirjh
Copy link
Contributor

fedirjh commented Oct 26, 2023

Bump @pradeepmdk for #29743 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Oct 26, 2023
@pradeepmdk
Copy link
Contributor

@fedirjh sorry for the delay. proposal updated #29743 (comment)

@fedirjh
Copy link
Contributor

fedirjh commented Oct 26, 2023

@pradeepmdk Thanks for the update, however, the root cause is still not clear to me. Why does this only affect Android? does the library have platform-specific code?

@mountiny
Copy link
Contributor

mountiny commented Jan 9, 2024

Ih sorry I misunderstood, I thought a patch for the new issue. Then I think we can go ahead with the patch until the other issue is resolved.

The upstream bug arise from a recently merged PR : wonday/react-native-pdf#792 , I think we should just revert it as the PR doesn’t include any revelent description or details.

If you know its that PR do you want to create Revert PR upstream and tag the maintainer, maybe they will be fine with the revert. Thanks!

@pradeepmdk
Copy link
Contributor

thanks @mountiny i will prepare the patch PR

@fedirjh
Copy link
Contributor

fedirjh commented Jan 23, 2024

cc @pradeepmdk any update for this one?

Edit: I just mistakenly pinged the wrong person. sorry for the noise @abekkala .

@abekkala
Copy link
Contributor

@mountiny can you help untangle this a bit for me?
Did the original PR for this issue (20743) cause the regression noted above that required a revert and patch fix?

I'm not sure how payments works for this one given the original PR, revert, patch, etc. that has occurred here.

@fedirjh
Copy link
Contributor

fedirjh commented Jan 24, 2024

@abekkala This is not yet ready for payment. We are still awaiting updates from @pradeepmdk.

@pradeepmdk
Copy link
Contributor

oh sorry, I missed this I will update you tomorrow end of the day.

@abekkala
Copy link
Contributor

@fedirjh

This is not yet ready for payment. We are still awaiting updates from @pradeepmdk.

Perfect, thanks for confirming. It didn't think it was so figured I'd better make sure I hadn't missed something!

@pradeepmdk
Copy link
Contributor

@fedirjh PR is ready.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Feb 7, 2024
@melvin-bot melvin-bot bot changed the title [$500] Android-Attachments-App crashes on uploading specific PDF [HOLD for payment 2024-02-14] [$500] Android-Attachments-App crashes on uploading specific PDF Feb 7, 2024
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Feb 7, 2024
Copy link

melvin-bot bot commented Feb 7, 2024

Reviewing label has been removed, please complete the "BugZero Checklist".

Copy link

melvin-bot bot commented Feb 7, 2024

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.37-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

If no regressions arise, payment will be issued on 2024-02-14. 🎊

For reference, here are some details about the assignees on this issue:

  • @pradeepmdk requires payment (Needs manual offer from BZ)
  • @fedirjh requires payment (Needs manual offer from BZ)

Copy link

melvin-bot bot commented Feb 7, 2024

BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

  • [@fedirjh] The PR that introduced the bug has been identified. Link to the PR:
  • [@fedirjh] 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:
  • [@fedirjh] A discussion in #expensify-bugs 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:
  • [@fedirjh] Determine if we should create a regression test for this bug.
  • [@fedirjh] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
  • [@abekkala] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@abekkala
Copy link
Contributor

abekkala commented Feb 8, 2024

PAYMENTS FOR FEB 14

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Feb 13, 2024
Copy link

melvin-bot bot commented Feb 14, 2024

Payment Summary

Upwork Job

  • ROLE: @pradeepmdk paid $(AMOUNT) via Upwork (LINK)
  • ROLE: @fedirjh paid $(AMOUNT) via Upwork (LINK)

BugZero Checklist (@abekkala)

  • I have verified the correct assignees and roles are listed above and updated the neccesary manual offers
  • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1714218588456812544/hired)
  • I have paid out the Upwork contracts or cancelled the ones that are incorrect
  • I have verified the payment summary above is correct

@melvin-bot melvin-bot bot added the Overdue label Feb 15, 2024
@abekkala
Copy link
Contributor

@pradeepmdk payment sent and contract ended - thank you! 🎉

@melvin-bot melvin-bot bot removed the Overdue label Feb 15, 2024
@abekkala
Copy link
Contributor

@fedirjh can you complete the checklist, please? I can then send payment for this job

@fedirjh
Copy link
Contributor

fedirjh commented Feb 15, 2024

BugZero Checklist:

  • Link to the PR: N/A This is an upstream bug
  • Link to discussion: N/A
  • Determine if we should create a regression test for this bug: Yes

Regression Test Proposal

1. Launch App on Android native.
2. Navigate to any report.
3. Tap plus icon near composer
4. Tap Add attachments.
5. Tap Choose document.
6. Select this PDF file -> https://github.com/Expensify/App/files/12927237/class-9-maths-chapter-10-solutions.pdf
7. Verify pdf is loaded successfully and app did not crash.
  • Do we agree 👍 or 👎

@abekkala
Copy link
Contributor

@fedirjh payment sent and contract ended - thank you! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 Engineering Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants