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 2023-11-01] [$500] Chat - Blank space appears with no preview or error message when corrupted file is sent #27292

Closed
6 tasks done
lanitochka17 opened this issue Sep 12, 2023 · 51 comments
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 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Internal Requires API changes or must be handled by Expensify staff

Comments

@lanitochka17
Copy link

lanitochka17 commented Sep 12, 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!


Action Performed:

  1. Go to staging.new.expensify.com
  2. Go to any chat
  3. Upload and send a corrupted file (QA.pdf) to the chat

Expected Result:

'Uploading attachment...' is shown with error message that the attachment cannot be uploaded

Actual Result:

Attachment is uploaded but blank space appears in the chat with no preview or error message
On Android app, it shows 'Failed to load PDF file' instead of blank space

Workaround:

Unknown

Platforms:

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

  • Android / native
  • Android / Chrome
  • iOS / native
  • iOS / Safari
  • MacOS / Chrome / Safari
  • MacOS / Desktop

Version Number: 1.3.68-15

Reproducible in staging?: Yes

Reproducible in production?: Yes

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

Notes/Photos/Videos: Any additional supporting documentation

Bug6198056_20230913_014856.mp4

Expensify/Expensify Issue URL:

Issue reported by: Applause - Internal team

Slack conversation:

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01665e174bbccf204b
  • Upwork Job ID: 1703838822623637504
  • Last Price Increase: 2023-10-16
@lanitochka17 lanitochka17 added Daily KSv2 Bug Something is broken. Auto assigns a BugZero manager. labels Sep 12, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 12, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Sep 12, 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

@maddylewis
Copy link
Contributor

Upload and send a corrupted file (use the txt to pdf file attached) to the chat

@lanitochka17 - should i be testing this using a specific txt to pdf file?

@lanitochka17
Copy link
Author

@maddylewis Hello
Tester used this file
QA.pdf

@melvin-bot melvin-bot bot added the Overdue label Sep 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

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

@maddylewis
Copy link
Contributor

thanks for confirming -- reviewing again now

@melvin-bot melvin-bot bot removed the Overdue label Sep 18, 2023
@maddylewis
Copy link
Contributor

maddylewis commented Sep 18, 2023

i can repro this
image
image

@maddylewis maddylewis added the External Added to denote the issue can be worked on by a contributor label Sep 18, 2023
@melvin-bot melvin-bot bot changed the title Chat - Blank space appears with no preview or error message when corrupted file is sent [$500] Chat - Blank space appears with no preview or error message when corrupted file is sent Sep 18, 2023
@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

Job added to Upwork: https://www.upwork.com/jobs/~01665e174bbccf204b

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

melvin-bot bot commented Sep 18, 2023

Current assignee @maddylewis is eligible for the External assigner, not assigning anyone new.

@melvin-bot
Copy link

melvin-bot bot commented Sep 18, 2023

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

@abdel-h66
Copy link
Contributor

abdel-h66 commented Sep 18, 2023

Proposal

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

Failed PDF preview displays an empty comment.

What is the root cause of that problem?

When a pdf file is corrupt, the preview won't be possible which is a normal behavior of react-pdf library. expect in the code we are handling both display cases for the <AttachmentModal /> and the other PDF preview that happens is shown in the comments.

A css class is applied in both cases, when applied to the comments section it will make the text disappear pretty much.

.react-pdf__message {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

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

First thing will be getting rid of the css class here as removing didnt affect the current behavior. the text in the attahcment modal was still centered correctly.

App/assets/css/pdf.css

Lines 14 to 19 in 6be8fca

.react-pdf__message {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}

Then we will need a way to allow the to distinguish both cases. We can pass a prop from <AttachmentModal /> to <PDFView />, this in return will alllow us to perform the following check.

            const renderErrorMessage = () => {
                if(this.props.isAttachmentModal) {
                    return <Text style={[styles.textLabe, styles.textLarge]}>{this.props.translate('attachmentView.failedToLoadPDF')}</Text>
                } 
                return <Text style={[styles.textLabe]}>{this.props.translate('attachmentView.failedToLoadPDF')}</Text>
            }

The styling of the text message can be improved to look like a message, or maybe display an error icon or something similar.

Blank-space-no-more

What alternative solutions did you explore? (Optional)

To avoid any potential regression from removing the css class .react-pdf__message we can simply create new class for the error messages, and apply them based on where the error message appears.

@b4s36t4
Copy link
Contributor

b4s36t4 commented Sep 18, 2023

Proposal

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

Chat - Blank space appears with no preview or error message when corrupted file is sent

What is the root cause of that problem?

We already have error handler which show the failed message on attachment modal but it's not showing here.

If a PDF is correct and valid backend send us the preview of the PDF as a image and we render that image.

error={<Text style={[styles.textLabel, styles.textLarge]}>{this.props.translate('attachmentView.failedToLoadPDF')}</Text>}

But due to the component rendering (PDFView) because backend is not sending any html preview image we're rendering the error message but it's not appearing because of styling issues.

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

We can use onLoadError from the Document component and set a flag to figure weather the loaded PDF is an error. If it's an error we can have some minHeight & minWidth which helps shows the rendered text.

What alternative solutions did you explore? (Optional)

NA

Screenshot 2023-09-19 at 1 12 08 AM Screenshot 2023-09-19 at 1 14 36 AM

We might need design review from expensify on how we want to show the error preview.

With this approach user can download the file attached, which we might want to keep or not. We can tweak settings for
that as well if we want to restrict the download.

@melvin-bot melvin-bot bot added the Overdue label Sep 21, 2023
@eVoloshchak
Copy link
Contributor

eVoloshchak commented Sep 21, 2023

@abdel-h66's proposal looks good to me!
react-pdf__message class is indeed at fault, we're correctly detecting that the document is invalid, but due to css class Failed to load PDF file is simply not visible.

'Uploading attachment...' is shown with error message that the attachment cannot be uploaded

Im not sure if we need to display a different message in this case, Failed to load PDF file might be more fitting. If you refresh the page, 'attachment cannot be uploaded' message would be misleading (since it was uploaded, the app just can't display it since it's corrupt). In addition to that, if you send this file to another user, they also should be presented with Failed to load PDF file message, since it was clearly uploaded successfully, but again, can't be displayed

🎀👀🎀 C+ reviewed!

@melvin-bot
Copy link

melvin-bot bot commented Sep 21, 2023

Triggered auto assignment to @joelbettner, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

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

melvin-bot bot commented Sep 25, 2023

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

@eVoloshchak

This comment was marked as duplicate.

@melvin-bot melvin-bot bot removed the Overdue label Sep 25, 2023
@abdel-h66
Copy link
Contributor

PR ready @eVoloshchak ! :)

@eVoloshchak
Copy link
Contributor

This bug isn't present in native platforms, but while testing I discovered another bug that is specific to native platforms only
When uploading a corrupted PDF file, the whole screen becomes blank for a moment

Screen.Recording.2023-10-19.at.19.34.18.mov

@joelbettner, should we handle this here or in a separate issue? This has a different root cause, but the bugs are related

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels Oct 25, 2023
@melvin-bot melvin-bot bot changed the title [$500] Chat - Blank space appears with no preview or error message when corrupted file is sent [HOLD for payment 2023-11-01] [$500] Chat - Blank space appears with no preview or error message when corrupted file is sent Oct 25, 2023
@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label Oct 25, 2023
@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 2023

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

@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 2023

The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.90-2 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 2023-11-01. 🎊

After the hold period is over and BZ checklist items are completed, please complete any of the applicable payments for this issue, and check them off once done.

  • External issue reporter
  • Contributor that fixed the issue
  • Contributor+ that helped on the issue and/or PR

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

As a reminder, here are the bonuses/penalties that should be applied for any External issue:

  • Merged PR within 3 business days of assignment - 50% bonus
  • Merged PR more than 9 business days after assignment - 50% penalty

@melvin-bot
Copy link

melvin-bot bot commented Oct 25, 2023

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:

  • [@eVoloshchak] The PR that introduced the bug has been identified. Link to the PR:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] 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:
  • [@eVoloshchak] Determine if we should create a regression test for this bug.
  • [@eVoloshchak] 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.
  • [@maddylewis] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels Nov 1, 2023
@maddylewis
Copy link
Contributor

maddylewis commented Nov 2, 2023

Payments

Details I have - PR merged on Oct 23 / Contributor hired on Oct 11

@maddylewis
Copy link
Contributor

hey @abdel-h66 - will you link your Upwork profile? I need to invite you to the job, and can't locate you on Upwork.

here is the job posting for reference - https://www.upwork.com/jobs/~0132e836fa8add0c70

@abdel-h66
Copy link
Contributor

Hey @maddylewis the calculations don't seem right to me, These are what I believe to be the correct ones. Please double-check and let me know :) thanks

Assigned: October 11 at 11:47PM
PR Merged: October 23 at 8:09PM

And for my freelance profile it should be this
https://www.upwork.com/freelancers/~01309bb28dda275941

@melvin-bot melvin-bot bot added the Overdue label Nov 6, 2023
@eVoloshchak
Copy link
Contributor

  • The PR that introduced the bug has been identified. Link to the PR: N/A. The error handling was added in Fix failed to load PDF error color and translation #13409, but only for the case when the file has failed to load when viewing it in an attachment view (for instance, when offline). This particular case with a corrupt file is an edge case we didn't account for from the beginning, so it's more of a feature request
  • 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: N/A
  • 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: Don't think an additional discussion is needed, this is an isolated edge case

@melvin-bot melvin-bot bot removed the Overdue label Nov 6, 2023
@eVoloshchak
Copy link
Contributor

Regression Test Proposal

  1. Open any chat
  2. Select the following PDF as an attachment (https://github.com/Expensify/App/files/12919474/QA.Expensify.Issue.27292.pdf)
  3. Verify that Failed to load PDF file. message appears when previewing a corrupt PDF file
  4. Click Send
  5. Verify that Failed to load PDF file. message appears in chat after sending a corrupt PDF file

Do we agree 👍 or 👎

@eVoloshchak
Copy link
Contributor

Details I have - PR merged on Oct 23 / Contributor hired on Sep 21

@maddylewis, this doesn't seem correct
Contributor was hired on Oct 11

@melvin-bot melvin-bot bot added the Overdue label Nov 8, 2023
@maddylewis
Copy link
Contributor

thanks for clarifying - updated payment amounts to $500

@melvin-bot melvin-bot bot removed the Overdue label Nov 8, 2023
@maddylewis
Copy link
Contributor

offer sent @abdel-h66 !

@maddylewis
Copy link
Contributor

@abdel-h66 - could you accept the offer i sent you in Upwork so i can process payment/close this out? ty!

@melvin-bot melvin-bot bot added the Overdue label Nov 13, 2023
@maddylewis
Copy link
Contributor

paid - #27292 (comment)

@melvin-bot melvin-bot bot removed the Overdue label Nov 13, 2023
@JmillsExpensify
Copy link

$500 payment approved for @eVoloshchak based on this comment.

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 External Added to denote the issue can be worked on by a contributor Help Wanted Apply this label when an issue is open to proposals by contributors Internal Requires API changes or must be handled by Expensify staff
Projects
None yet
Development

No branches or pull requests

7 participants