Repository navigation
fix: Profile - No error after uploading corrupted jpg for avatar, console error shows up. - #49203
Conversation
…sole error shows up. Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
| }); | ||
| }); | ||
| return; | ||
| } |
There was a problem hiding this comment.
@Ollyws, we have to skip corrupt image validation in AttachmentPicker because, on native devices, we were showing an alert modal if the image was corrupt, which we don't need when using AttachmentPicker inside AvatarWithImagePicker because we already perform validation in the AvatarWithImagePicker component.
There was a problem hiding this comment.
Hmm...would it make more sense to do the image validation in AttachmentPicker on both platforms?
There was a problem hiding this comment.
I tried, but I wasn't able to get it working. I'll try again today or tomorrow.
There was a problem hiding this comment.
@Ollyws, I tried and we can show the validation modal in AttachmentPicker for web, but I don't think it's worth it since the native validation shows only the default alert and in this case we should show the our custom modal. We can simply skip the validation in native file. WDYT?
There was a problem hiding this comment.
@Ollyws, friendly bump to check the comment above.
There was a problem hiding this comment.
We can simply skip the validation in native file
You mean just leave the changes as they are?
There was a problem hiding this comment.
Ok it's not a huge issue so I think it's fine as is.
|
Will get to this one tomorrow. |
| .then(() => resolve()) | ||
| .catch(() => reject(new Error('Error reading file: The file is corrupted'))); | ||
| .then((size) => { | ||
| if (size.height <= 0 || size.width <= 0) { |
There was a problem hiding this comment.
Why's this change necessary?
There was a problem hiding this comment.
On native, when an image is corrupted, ImageSize.getSize does not throw an error but returns an image with a width and height of -1.
The same method is used here:
App/src/components/AttachmentPicker/index.native.tsx
Lines 272 to 280 in 37bf6b2
|
Sorry for delay, I will work on this today. |
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
Reviewer Checklist
Screenshots/Videos |
srikarparsi
left a comment
There was a problem hiding this comment.
Just one change from me
| <AttachmentPicker type={CONST.ATTACHMENT_PICKER_TYPE.IMAGE}> | ||
| <AttachmentPicker | ||
| type={CONST.ATTACHMENT_PICKER_TYPE.IMAGE} | ||
| shouldValidateImage={false} |
There was a problem hiding this comment.
Can you please add a comment explaining why we don't need to validate here
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
srikarparsi
left a comment
There was a problem hiding this comment.
This makes sense to me. The alternative is to do validation in web and native AttachmentPicker but native has a default alert we would have to override.
|
✋ 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 staging by https://github.com/srikarparsi in version: 9.0.43-0 🚀
|
1 similar comment
|
🚀 Deployed to staging by https://github.com/srikarparsi in version: 9.0.43-0 🚀
|
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.43-6 🚀
|






Details
Fixed Issues
$ #48707
PROPOSAL: #48707 (comment)
Tests
Offline tests
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.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