Skip to content

Odometer - No error message when uploading corrupted file #82663

Closed

Description

@jponikarchuk

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: 9.3.20-4
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #80532
Email or phone of affected tester (no customers): applausetester+ihbuiivyw@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Log in with Expensifail account.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Click + > Track distance > Odometer.
  4. Click image thumbnail next to Start reading.
  5. Upload a corrupted pdf file (attached below).

Expected Result:

Error message will show up.

Actual Result:

No error message shows up when uploading corrupted file.

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

1.mp4

LARGE_PDF_FILE_corrupted.pdf

View all open jobs on GitHub

Activity

  1. abbasifaizan70 commented on Feb 17, 2026

    @abbasifaizan70
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    No error message is shown when uploading a corrupted PDF.

    What is the root cause of that problem?

    The odometer image step uses useFilesValidation to validate chosen files and show the shared ErrorModal when validation fails. For PDFs, the hook relies on rendering invisible PDFThumbnail components that load the PDF and call onLoadSuccess or onLoadError; only after that does it call checkIfAllValidatedAndProceed(), which opens the error modal when collectedErrors contains FILE_CORRUPTED. In IOURequestStepOdometerImage the hook’s PDFValidationComponent (which contains those PDFThumbnail instances) is never rendered. So when the user selects a PDF, the hook sets pdfFilesToRender and waits for thumbnail load callbacks, but because PDFValidationComponent is not in the tree, the thumbnails never mount, the callbacks never run, and the error modal never appears.

    Relevant behavior (permalinks = links to code on main):

    • Odometer image step uses only validateFiles and ErrorModal – PDFValidationComponent is not destructured or rendered, so PDF validation never runs.

      const {validateFiles, ErrorModal} = useFilesValidation((files: FileObject[]) => {
      if (files.length === 0) {
      return;
      }
      const file = files.at(0);
      if (!file) {
      return;
      }
      // For file selection, source is the blob URL
      handleImageSelected(file);
      });

    • PDF validation depends on rendering PDFValidationComponent – The hook renders invisible PDFThumbnail components for each PDF; onLoadError pushes FILE_CORRUPTED and calls checkIfAllValidatedAndProceed(), which opens the error modal.

      const PDFValidationComponent = pdfFilesToRender.length
      ? pdfFilesToRender.map((file) => (
      <PDFThumbnail
      key={file.uri}
      style={styles.invisiblePDF}
      previewSourceURL={file.uri ?? ''}
      onLoadSuccess={() => {
      validatedPDFs.current.push(file);
      validFiles.current.push(file);
      checkIfAllValidatedAndProceed();
      }}
      onPassword={() => {
      validatedPDFs.current.push(file);
      if (isValidatingReceipts === true) {
      collectedErrors.current.push({error: CONST.FILE_VALIDATION_ERRORS.PROTECTED_FILE});
      } else {
      validFiles.current.push(file);
      }
      checkIfAllValidatedAndProceed();
      }}
      onLoadError={() => {
      validatedPDFs.current.push(file);
      collectedErrors.current.push({error: CONST.FILE_VALIDATION_ERRORS.FILE_CORRUPTED});
      checkIfAllValidatedAndProceed();
      }}
      />
      ))
      : undefined;

    • Scan step correctly renders PDFValidationComponent – Same flow (file picker + validation) renders PDFValidationComponent so PDF load success/error runs and the modal can show.

      const {validateFiles, PDFValidationComponent, ErrorModal} = useFilesValidation(setReceiptFilesAndNavigate);

    >
    {PDFValidationComponent}
    <Icon

    What changes do you think we should make in order to solve the problem?

    Render PDFValidationComponent in IOURequestStepOdometerImage so that when a PDF is selected (e.g. from "Choose file" or drag-and-drop), the invisible PDFThumbnail components mount, load the PDF, and trigger onLoadError for corrupted PDFs. The existing useFilesValidation logic will then show the error modal. No change to the hook or error copy is required.

    Solution – new code (git diff):

    --- a/App/src/pages/iou/request/step/IOURequestStepOdometerImage/index.tsx
    +++ b/App/src/pages/iou/request/step/IOURequestStepOdometerImage/index.tsx
    @@ -77,7 +77,7 @@ function IOURequestStepOdometerImage({
             handleImageSelected(file);
         });
    
    -    const {validateFiles, ErrorModal} = useFilesValidation((files: FileObject[]) => {
    +    const {validateFiles, PDFValidationComponent, ErrorModal} = useFilesValidation((files: FileObject[]) => {
             if (files.length === 0) {
                 return;
             }
    @@ -159,6 +159,7 @@ function IOURequestStepOdometerImage({
                 {(isDraggingOverWrapper) => (
                     <View style={[styles.flex1, styles.chooseFilesView(isSmallScreenWidth)]}>
                         <View style={[styles.flex1, styles.alignItemsCenter, styles.justifyContentCenter]}>{!(isDraggingOver ?? isDraggingOverWrapper) && desktopUploadView()}</View>
    +                    {PDFValidationComponent}
                         <DragAndDropConsumer onDrop={handleDrop}>
                             <DropZoneUI
                                 icon={icon}
  2. melvin-bot commented on Feb 23, 2026

    @melvin-bot

    Huh... This is 4 days overdue. Who can take care of this?

  3. melvin-bot commented on Mar 5, 2026

    @melvin-bot

    This issue has not been updated in over 14 days. eroding to Weekly issue.

  4. melvin-bot commented on Mar 30, 2026

    @melvin-bot

    This issue has not been updated in over 15 days. eroding to Monthly issue.

    P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do!

  5. melvin-bot commented on Jun 11, 2026

    @melvin-bot

    @jponikarchuk, this Monthly task hasn't been acted upon in 6 weeks; closing.

    If you disagree, feel encouraged to reopen it -- but pick your least important issue to close instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions