Skip to content

Commit

Permalink
refactor: remove base64 in cropOrRotateImage
Browse files Browse the repository at this point in the history
  • Loading branch information
kosmydel committed Mar 13, 2024
1 parent df67dae commit eb61a54
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
9 changes: 1 addition & 8 deletions src/libs/actions/PersonalDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,14 +382,7 @@ function updateAvatar(file: File | CustomRNImageManipulatorResult) {
},
];

let parameters: UpdateUserAvatarParams = {file};

// We need to remove the base64 value from the file object, as it is causing crashes on Release builds.
// More info: https://github.com/Expensify/App/issues/37963#issuecomment-1989260033
if ('base64' in file) {
const {base64, ...fileWithoutBase64} = file;
parameters = {file: fileWithoutBase64};
}
const parameters: UpdateUserAvatarParams = {file};

API.write(WRITE_COMMANDS.UPDATE_USER_AVATAR, parameters, {optimisticData, successData, failureData});
}
Expand Down
4 changes: 3 additions & 1 deletion src/libs/cropOrRotateImage/index.native.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import type {CropOrRotateImage} from './types';
const cropOrRotateImage: CropOrRotateImage = (uri, actions, options) =>
new Promise((resolve) => {
const format = getSaveFormat(options.type);
manipulateAsync(uri, actions, {compress: options.compress, format}).then((result) => {
// We need to remove the base64 value from the result, as it is causing crashes on Release builds.
// More info: https://github.com/Expensify/App/issues/37963#issuecomment-1989260033
manipulateAsync(uri, actions, {compress: options.compress, format}).then(({base64, ...result}) => {
RNFetchBlob.fs.stat(result.uri.replace('file://', '')).then(({size}) => {
resolve({
...result,
Expand Down

0 comments on commit eb61a54

Please sign in to comment.