-
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: wrong attachment corrupt alert for pdf. #40351
Conversation
Signed-off-by: Krishna Gupta <belivethatkg@gmail.com>
@francoisl 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] |
@francoisl sorry for the ping :( cc: @paultsimura |
@Krishna2323 could you please explain this change a little? What specifically caused the issue with PDF? |
// The width/height for corrupt file is -1 on android native and 0 on ios native | ||
if (width <= 0 || height <= 0) { | ||
throw new Error('Image dimensions are invalid.'); | ||
} |
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.
// The width/height for corrupt file is -1 on android native and 0 on ios native | |
if (width <= 0 || height <= 0) { | |
throw new Error('Image dimensions are invalid.'); | |
} |
// The width/height for corrupt file is -1 on android native and 0 on ios native | ||
if (!fileData.width || !fileData.height || (fileData.width <= 0 && fileData.height <= 0)) { | ||
if (fileData.width === -1 || fileData.height === -1) { |
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't we go this way instead?
// Check if the file dimensions indicate corruption
// The width/height for a corrupted file is -1 on android native and 0 on ios native
// We must check only numeric values because the width/height can be undefined for non-image files
if (typeof fileData.width === 'number' && fileData.width <= 0 || typeof fileData.height === 'number' && fileData.height <= 0) {
showImageCorruptionAlert();
return Promise.resolve();
}
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, this will also work.
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.
I think it's better because we'll keep validating the dimensions in one place. Please update
This function also runs for non-image files, and width/height is undefined in that case. App/src/components/AttachmentPicker/index.native.tsx Lines 238 to 245 in 553e54f
|
Also, please fill in the checklist |
Signed-off-by: Krishna Gupta <belivethatkg@gmail.com>
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid00.06.mp4Android: mWeb ChromeiOS: NativeSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-04-17.at.23.23.5700.06.mp4iOS: mWeb SafariSimulator.Screen.Recording.-.iPhone.15.Pro.Max.-.2024-04-18.at.00.09.0100.09.mp4MacOS: Chrome / SafariScreen.Recording.2024-04-18.at.00.04.2500.06.mp4MacOS: DesktopScreen.Recording.2024-04-18.at.00.06.1400.06.mp4 |
@Krishna2323 please put #37435 under the fixed issues instead of the PR link you've added. |
🎯 @paultsimura, thanks for reviewing and testing this PR! 🎉 An E/App issue has been created to issue payment here: #40384. |
@arosiclair this is a follow-up of #40162. Please review when you have a minute 🙇 |
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.
Thanks for the fix 👍
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/mountiny in version: 1.4.64-6 🚀
|
Details
Fixed Issues
$ #37435
PROPOSAL:
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.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 and/or tagged@Expensify/design
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
android_native.mp4
Android: mWeb Chrome
android_chrome.mp4
iOS: Native
ios_native.mp4
iOS: mWeb Safari
ios_safari.mp4
MacOS: Chrome / Safari
web_chrome.mp4
MacOS: Desktop
desktop_app.mp4