-
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
fix crash attachment #34030
fix crash attachment #34030
Conversation
@0xmiroslav Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good. Testing
src/libs/ReceiptUtils.ts
Outdated
@@ -66,7 +66,7 @@ function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string | |||
image = ReceiptSVG; | |||
} | |||
|
|||
const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:'); | |||
const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:') || path === ReceiptGeneric; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is type of ReceiptGeneric
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah it's string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok confirmed string on web, number on native.
So Case 1 bug is supposed to happen only on web
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm doesn't this apply to all paths that have a local file then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think if we check isLocalFile we should use this, currently I see we build the isLocalFile only in this function getThumbnailAndImageURIs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we apply a more hollistic approach to isLocalFile though? I imagine in the future we'll have more web assets we pass into getThumbnailAndImageURIs and ideally we don't just add an if check for each path. Maybe we can check if it starts with '/'? What do you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think it is good, we can modify it like that to cover all we assets' path:
const isLocalFile = ... path.startsWith('/');
@namhihi237 this doesn't work correctly Screen.Recording.2024-01-05.at.5.17.10.pm.mov |
Seem it does not relative this PR |
I test on production and this issue still happen |
ok then out of scope |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemchrome.moviOS: Nativeios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thienlnam this needs CP'ed
@namhihi237 Is this issue also a regression? Will it be handled by the PR? |
I will test this |
I can not reproduce on the main, anyone can reproduce? I test it to work on main and this PR. |
same |
Maybe PR will fix this issue #34049 |
@namhihi237 Let's make sure #34049 issue is also handled by this PR. |
Testing on it |
Tested and was cover |
Thank you @namhihi237 for quick response. Let's keep an eye open for probable deploy blockers. |
@thienlnam PR updated |
Screen.Recording.2024-01-08.at.10.51.41.movScreen.Recording.2024-01-08.at.10.53.16.movScreen.Recording.2024-01-08.at.10.55.37.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely, thanks!
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
fix crash attachment (cherry picked from commit cfdd159)
🚀 Cherry-picked to staging by https://github.com/thienlnam in version: 1.4.22-3 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/thienlnam in version: 1.4.22-6 🚀
|
@@ -66,7 +66,7 @@ function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string | |||
image = ReceiptSVG; | |||
} | |||
|
|||
const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:'); | |||
const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:') || path.startsWith('/'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR created a problem with eReceipts that have pending waypoints. Issue #34287
Details
This PR is to try to fix regression from PR
Fixed Issues
$ #34016
$ #33985
PROPOSAL:
Tests
Case 1:
Case 2:
Offline tests
The same test
QA Steps
The same test
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Screen.Recording.2024-01-05.at.22.38.47.mov
Android: mWeb Chrome
Screen.Recording.2024-01-05.at.22.42.37.mov
iOS: Native
Screen.Recording.2024-01-05.at.22.35.53.mov
iOS: mWeb Safari
Screen.Recording.2024-01-05.at.22.37.29.mov
MacOS: Chrome / Safari
webb.mp4
MacOS: Desktop
desk.mp4