Skip to content

Commit c1b3f70

Browse files
committed
fix: validate the same source that is uploaded (catches Replace/Crop to oversized)
1 parent a1fe816 commit c1b3f70

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/pages/Share/SubmitDetailsPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,6 @@ function SubmitDetailsPage({
114114
const fileType = shouldUsePreValidatedFile ? (validFilesToUpload?.type ?? CONST.RECEIPT_ALLOWED_FILE_TYPES.JPEG) : (currentAttachment?.mimeType ?? '');
115115
const [hasOnlyPersonalPolicies = false] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: hasOnlyPersonalPoliciesUtil});
116116

117-
useShareFileSizeValidation(currentAttachment?.content, setErrorTitle, setErrorMessage, !errorTitle);
118-
119117
useEffect(() => {
120118
if (!errorTitle || !errorMessage) {
121119
return;
@@ -160,6 +158,9 @@ function SubmitDetailsPage({
160158
const currentReceiptName = (transaction?.receipt?.filename?.split('/').pop() ?? '') || sharedFileName;
161159
const currentReceiptType = transaction?.receipt?.type ?? sharedFileType;
162160

161+
// Validate the same source that performUpload reads — so Replace/Crop to an oversized file is still caught before submit.
162+
useShareFileSizeValidation(currentReceiptSource, setErrorTitle, setErrorMessage, !errorTitle);
163+
163164
const selectedParticipants = unknownUserDetails ? [unknownUserDetails] : getMoneyRequestParticipantsFromReport(report, currentUserPersonalDetails.accountID);
164165
const participants = selectedParticipants.map((participant) => {
165166
const privateIsArchived = privateIsArchivedMap[`${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${participant.reportID}`];

0 commit comments

Comments
 (0)