Skip to content

Fix FormData parsing error in file upload handlers#448

Merged
SvenVw merged 2 commits into
mainfrom
hotfix/FDM447
Feb 3, 2026
Merged

Fix FormData parsing error in file upload handlers#448
SvenVw merged 2 commits into
mainfrom
hotfix/FDM447

Conversation

@SvenVw
Copy link
Copy Markdown
Collaborator

@SvenVw SvenVw commented Feb 3, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Fixed file upload errors (FormDataParseError) that occurred during soil analysis and field data uploads, ensuring files are properly handled during storage retrieval processes
  • Chores

    • Version bumped to 0.27.2
    • Updated changelog

closes #447

@SvenVw SvenVw self-assigned this Feb 3, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 3, 2026

⚠️ No Changeset found

Latest commit: d5fe9b0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 3, 2026

👋 Hotfix Branch PR Detected!

Before merging this Pull Request into main, please ensure you have finalized the hotfix by manually running the 'Release' workflow on this hotfix/FDM447 branch.

This will:

  1. Bump package versions.
  2. Generate changelogs.
  3. Create Git tags.

You can trigger the workflow from the 'Actions' tab, selecting the 'Release' workflow, and choosing this hotfix/FDM447 branch.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 3, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

The PR addresses a FormDataParseError occurring when using createFsFileStorage with React Router v7. Three upload handler routes are modified to convert LazyFile objects to native File objects by calling .toFile() when available. Package version is bumped to 0.27.2 and changelog is updated.

Changes

Cohort / File(s) Summary
Upload Handlers
fdm-app/app/routes/farm.$b_id_farm.$calendar.field.$b_id.soil.analysis.new.upload.tsx, fdm-app/app/routes/farm.create.$b_id_farm.$calendar.fields.$b_id.soil.analysis.upload.tsx, fdm-app/app/routes/farm.create.$b_id_farm.$calendar.upload.tsx
After retrieving stored files, each handler now checks if the stored item has a toFile() method and calls it to convert LazyFile to native File; otherwise returns the stored value as-is. Prevents FormDataParseError by ensuring proper File objects are returned.
Version & Metadata
fdm-app/package.json, fdm-app/CHANGELOG.md
Version bumped from 0.27.1 to 0.27.2; changelog entry added describing the LazyFile-to-File conversion fix.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • gerardhros

Poem

🐰 A LazyFile hopped into a form,
But FormData said, "No, you're not quite the norm!"
So toFile() it called, converting with grace,
Now uploads flow smoothly, at a rabbit's own pace! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed All three affected uploadHandler files were modified to convert LazyFile to File using toFile() method, directly addressing the FormDataParseError reported in issue #447.
Out of Scope Changes check ✅ Passed All changes are scoped to the three upload route files specified in issue #447, with modifications limited to the uploadHandler logic for LazyFile conversion.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: fixing a FormData parsing error in file upload handlers by converting LazyFile to File, which aligns with the changeset and all modified files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hotfix/FDM447

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.07%. Comparing base (195dd44) to head (5e5ebf4).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #448   +/-   ##
=======================================
  Coverage   88.07%   88.07%           
=======================================
  Files          91       91           
  Lines        4621     4621           
  Branches     1492     1492           
=======================================
  Hits         4070     4070           
  Misses        551      551           
Flag Coverage Δ
fdm-calculator 88.76% <ø> (ø)
fdm-core 86.77% <ø> (ø)
fdm-data 92.12% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot changed the title @coderabbitai Fix FormData parsing error in file upload handlers Feb 3, 2026
@coderabbitai coderabbitai Bot added branch:main An issue, affecting the main branch, that requires an hotfix bug Something isn't working fdm-app labels Feb 3, 2026
@SvenVw SvenVw requested a review from BoraIneviNMI February 3, 2026 11:23
@SvenVw SvenVw merged commit c9c1494 into main Feb 3, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch:main An issue, affecting the main branch, that requires an hotfix bug Something isn't working fdm-app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant