Skip to content

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

Closed
wonday/react-native-pdf
#791

Description

@izarutskaya

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

Activity

  1. added
    External
    Daily
    Bug
    on Oct 17, 2023
  2. changed the title [-]Android-Attachments-App crashes on uploading specific PDF[/-] [+][$500] Android-Attachments-App crashes on uploading specific PDF[/+] on Oct 17, 2023
  3. melvin-bot commented on Oct 17, 2023

    @melvin-bot

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

  4. melvin-bot commented on Oct 17, 2023

    @melvin-bot
  5. added
    Help Wanted
    on Oct 17, 2023
  6. melvin-bot commented on Oct 17, 2023

    @melvin-bot

    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
  7. melvin-bot commented on Oct 17, 2023

    @melvin-bot

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

  8. pradeepmdk commented on Oct 17, 2023

    @pradeepmdk
    Contributor

    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]);
  9. thesahindia commented on Oct 19, 2023

    @thesahindia
    Member

    I am busy with other tasks so gonna unassign.

    cc: @abekkala

  10. removed their assignment
    on Oct 19, 2023
  11. removed
    External
    on Oct 19, 2023
  12. 142 remaining items

  13. removed
    Reviewing
    on Feb 7, 2024
  14. melvin-bot commented on Feb 7, 2024

    @melvin-bot

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

  15. melvin-bot commented on Feb 7, 2024

    @melvin-bot

    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)
  16. melvin-bot commented on Feb 7, 2024

    @melvin-bot

    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:
  17. abekkala commented on Feb 8, 2024

    @abekkala
    Contributor

    PAYMENTS FOR FEB 14

  18. added
    Daily
    and removed
    Weekly
    on Feb 13, 2024
  19. melvin-bot commented on Feb 14, 2024

    @melvin-bot

    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
  20. abekkala commented on Feb 15, 2024

    @abekkala
    Contributor

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

  21. abekkala commented on Feb 15, 2024

    @abekkala
    Contributor

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

  22. fedirjh commented on Feb 15, 2024

    @fedirjh
    Contributor

    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 👎
  23. abekkala commented on Feb 15, 2024

    @abekkala
    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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyEngineeringInternal

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions