-
Notifications
You must be signed in to change notification settings - Fork 3k
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-10-27] [$500] Android - Scan IOU - A broken image is downloaded to the device when receipt cannot be downloaded #27992
Comments
Triggered auto assignment to @sakluger ( |
Bug0 Triage Checklist (Main S/O)
|
Yep, that's a bug. @izarutskaya do you know what caused it to throw the error? |
Job added to Upwork: https://www.upwork.com/jobs/~0126f987f66d4dbcf0 |
Current assignee @sakluger is eligible for the External assigner, not assigning anyone new. |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mananjadhav ( |
ProposalPlease re-state the problem that we are trying to solve in this issue.As soon as user try downloading file then error is thrown along with junk file stored. What is the root cause of that problem?Root cause exists when we try to copy file in media store which does not exist. App/src/libs/fileDownload/index.android.js Lines 75 to 84 in 171259c
This results in junk file saved. What changes do you think we should make in order to solve the problem?Use RNFetchBlob.fs.exists(attachmentPath) to check if file exists before trying to save the file. Result: 0e23b2c6-cb5b-4260-b827-af117f8d6127.mp4What alternative solutions did you explore? (Optional)We can alternatively check for file system issues happening through the app and fix them all. |
Hi @mananjadhav, I hope you're well. I would like to request your approval for my proposal. If you can provide the approval, I will be able to create the pull request (PR) within the next hour. Your prompt response would be greatly appreciated. Thank you for your consideration. Best regards, |
ProposalPlease re-state the problem that we are trying to solve in this issue.Trying to download a local receipt image will give an error but a broken file is saved on the device. What is the root cause of that problem?First of all, I don't know the reason why a broken file is saved even though the download fails. On the native side, the lib already check whether the file exists or not. So, I want to focus on the other problem that is we can't download the local receipt image. When we do a scan request, the receipt image will initially be a local file. The local file URI looks like this (android).
Downloading a local file is basically copying the cached file above (that is selected from the gallery) to the
App/src/libs/fileDownload/index.android.js Lines 75 to 83 in 44568ba
However, when we try to download the receipt image, it will always append an auth token to the file URI because App/src/components/AttachmentModal.js Lines 169 to 175 in 44568ba
auth token is supposed to be used for remote resources only but we always set App/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js Lines 55 to 59 in 71db96d
so the local full URI would be like
And because of that, What changes do you think we should make in order to solve the problem?If it's a local file, set
the condition is taken from Line 20 in 71db96d
|
I think considering the broken behavior @bernhardoj's proposal makes more sense. Tagging @shawnborton @marcaaron @sakluger to confirm. 🎀 👀 🎀 C+ reviewed. |
Triggered auto assignment to @marcaaron, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Hmm my take is, is it possible to fix the fact that the image can't be downloaded? If not, then I agree, we should not download a broken image after seeing that error message. |
@shawnborton @mananjadhav it is android only bug. same code is getting file downloaded just fine in other platforms so basically file name convention is not a bug here. As I mentioned in my proposal it is android file system bug and needs to solved only in index.android.js. Quickest solution is to check whether file exists i.e. android file system can read the given file path. If not then dont save the file otherwise file stored will be empty. It is bug in the code it is not checking whether file exists prior to saving it in media store. |
Ah then if that is the case, let's try to fix the file not getting downloaded. |
@shawnborton yes I have proposed that already. |
@marcaaron @sakluger please provide your input about above comments. |
Well, wow, I actually don't super understand the root cause here. @bernhardoj's explanation is pretty unclear.
Can we not figure this out? Also why did the download fail? What do we need to understand this problem better?
I don't really understand what you are trying to say here. Where are we logging an image URI? And why does it "make sense" that the lib (which lib exactly?) can't find the file? 😕 I'm going to kick this one back to @mananjadhav to manage for now to try again. @mananjadhav Please work with the contributors here to put forward a complete proposal that clearly describes the problem and offers a solution. |
Updated my proposal to include more explanation.
I'm not trying to figure this out because the main issue is that we can't download the file.
It's just a log that I put to see the file URI. |
@marcaaron look at the video I attached with my proposal. Additionally copytomediastore copies existing file to media directory but if file does not exists then it will save empty file there. Android filesystem is not able to understand path provided, it is android only bug and exists due to OS incompatibility with the plugin . Simply using RNFetchBlob.fs.exists(attachmentPath) can avoid saving empty file which will sort out the issue. |
@mananjadhav can you please take a look at Marc and Shawn's concerns and advise how you think we should proceed here? |
@ayazalavi I don't review any proposals as I am not an engineer - I'm just helping to manage the GH issue and keep it moving forward. @marcaaron do you agree with @ArekChr's recommendation to go with @bernhardoj's solution? |
Sounds good. Yes I agree after reading the updated proposal. |
📣 @bernhardoj 🎉 An offer has been automatically sent to your Upwork account for the Contributor role 🎉 Thanks for contributing to the Expensify app! Offer link |
PR is ready cc: @ArekChr |
Looks like this would also fix #29749, could you confirm @ArekChr or @bernhardoj? |
@jjcoffee yes, I tested and that issue is fixed too. |
Issue not reproducible during KI retests. (Third week) |
🎯 ⚡️ Woah @ArekChr / @bernhardoj, great job pushing this forwards! ⚡️ The pull request got merged within 3 working days of assignment, so this job is eligible for a 50% #urgency bonus 🎉
On to the next one 🚀 |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 1.3.87-12 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-10-27. 🎊 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.
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:
|
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:
|
Regresion test proposal:
Do we agree 👍 or 👎 |
Proposed regression test steps look good. 👍 I've paid out @bernhardoj, so we're good to close this one. Thanks everyone! 🚀 |
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:
Note that a broken image is downloaded despite the error message.
Expected Result:
Nothing will be downloaded to the device since it shows 'Attachment cannot be downloaded' message.
Actual Result:
A broken image is downloaded to the device despite the 'Attachment cannot be downloaded' message.
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Version Number: v1.3.72-8
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
Notes/Photos/Videos: Any additional supporting documentation
Bug6208754_Screen_Recording_20230921_105335_Gallery.mp4
Expensify/Expensify Issue URL:
Issue reported by: Applause-Internal Team
Slack conversation: @
View all open jobs on GitHub
Upwork Automation - Do Not Edit
The text was updated successfully, but these errors were encountered: