-
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
[HOLD for payment 2024-10-17] The Heic format image showing as 2.5MB is uploading with size over 10MB #49999
Comments
Current assignee @mountiny is eligible for the AutoAssignerNewDotQuality assigner, not assigning anyone new. |
Triggered auto assignment to @isabelastisser ( |
Hi. I'm Olimpia from Callstack and I'd like to work on this issue. |
The issue stems from the manual conversion of HEIC images to JPEG, introduced in a PR aimed at fixing automatic HEIC-to-JPEG conversion. After the conversion, the
As a result,
function AttachmentPicker({type = CONST.ATTACHMENT_PICKER_TYPE.FILE, children, s
.then((isHEIC) => {
// react-native-image-picker incorrectly changes file extension without transcoding the HEIC file, so we are doing it manually if we detect HEIC signature
if (isHEIC && targetAssetUri) {
- manipulateAsync(targetAssetUri, [], {format: SaveFormat.JPEG})
+ manipulateAsync(targetAssetUri, [], {compress: 0.7, format: SaveFormat.JPEG})
.then((manipResult) => {
const uri = manipResult.uri;
const convertedAsset = { With this change, the final uploaded image size will be ~2.4 MB instead of over 10 MB
function AttachmentPicker({type = CONST.ATTACHMENT_PICKER_TYPE.FILE, children, s
const targetAsset = response.assets?.[0];
const targetAssetUri = targetAsset?.uri;
+ const targetOriginalSize = targetAsset?.fileSize;
if (!targetAssetUri) {
return resolve();
@@ -181,6 +182,7 @@ function AttachmentPicker({type = CONST.ATTACHMENT_PICKER_TYPE.FILE, children, s
type: 'image/jpeg',
width: manipResult.width,
height: manipResult.height,
+ fileSize: targetOriginalSize,
};
return resolve([convertedAsset]);
cc: @mountiny |
@OlimpiaZurek it might be good to try to keep the size of the file |
I agree that keeping the original file size is better option, as compressing the image could degrade its quality. However, after testing the second solution, I'm still encountering the same error: |
Thanks! Maybe the |
@mountiny It looks like While going through the code, I noticed there’s already a mechanism that automatically reduces the size of receipt images, which was added a few months ago (PR) . However, there seems to be a discrepancy between the maximum image size in the code (25MB) and the 10MB limit enforced by the backend. To fix this, we can update the code by adding a max size for receipts |
@OlimpiaZurek Ok yeah lets do that, the receipts have 10MB in the backend so lets try that |
|
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.47-4 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 2024-10-17. 🎊 For reference, here are some details about the assignees on this 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:
|
We only need to pay @eh2077 - the reward is $250 no need for checklist in this case as this was probably a side effect of using a library to process the heic image format |
Payment summary: $250 to @eh2077 for PR review. Payment |
Requested payment in NewDot |
$250 approved for @eh2077 |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number:
Reproducible in staging?:
Reproducible in production?:
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
Expensify/Expensify Issue URL:
Issue reported by:
Slack conversation:
Action Performed:
Break down in numbered steps
IMG_3877.HEIC.zip
heic
format and with 2.5MB attempt to scan a receipt in native iosExpected Result:
Describe what you think should've happened
The request is successful since the image is under 10MB.
Actual Result:
Describe what actually happened
The request fails because the uploaded file size in the end is over 10MB, seems like the conversion is not as efficient as it should be
Workaround:
Can the user still use Expensify without this being fixed? Have you informed them of the workaround?
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
View all open jobs on GitHub
Issue Owner
Current Issue Owner: @isabelastisserThe text was updated successfully, but these errors were encountered: