Skip to content

Conversation

@discreted66
Copy link
Collaborator

@discreted66 discreted66 commented Nov 13, 2025

PR

fix:修复edm上传模式,文件大小限制失效

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Bug Fixes
    • Improved file upload size validation: now correctly prioritizes configured size limits from multiple sources, handles array-based max-size inputs, and applies consistent unit conversion.
    • Expanded and more accurate file-size violation notifications so users receive clearer feedback when uploads exceed limits.

@github-actions github-actions bot added the bug Something isn't working label Nov 13, 2025
@coderabbitai
Copy link

coderabbitai bot commented Nov 13, 2025

Walkthrough

Reworked properFileSize logic to implement prioritized, multi-source max file size configuration with KB-to-MB unit conversions. EDM mode prioritizes edm.config.singleFileMaxSize over props.fileSize and state.singleMaxSize; non-EDM mode derives maxSize from props.fileSize (array or single value, converted to MB). Extended size validation triggers to cover EDM and array-based scenarios.

Changes

Cohort / File(s) Change Summary
File size validation refactoring
packages/renderless/src/file-upload/index.ts
Reworked properFileSize to implement prioritized multi-source max file size configuration: EDM mode prioritizes edm.config.singleFileMaxSize over props.fileSize and state.singleMaxSize; non-EDM mode derives from props.fileSize (array or single value). Added KB-to-MB unit conversions and extended size-exceed checks to apply when EDM mode is active or array-based fileSize is provided.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20–25 minutes

  • Areas requiring attention:
    • Multi-source configuration priority logic—verify correct precedence: EDM config → props → fallback to state
    • KB-to-MB conversion factors and consistent application across both EDM and non-EDM paths
    • Array-based fileSize handling—confirm all edge cases (empty array, mismatched types) are handled
    • Updated conditional triggering logic—ensure size checks fire correctly for both EDM and array scenarios
    • Fallback behavior when no config or props sizes are provided

Poem

🐰 A hop through the bytes, from KB to MB we go,
EDM leads first, then props take the flow,
Arrays and configs in harmony blend,
File validation: a journey without end! 📤

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing an ineffective file size limit in EDM upload mode, which aligns with the reworked properFileSize logic.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 76dbda7 and 8e0eec3.

📒 Files selected for processing (1)
  • packages/renderless/src/file-upload/index.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-12-02T08:56:05.176Z
Learnt from: zzcr
Repo: opentiny/tiny-vue PR: 2584
File: packages/renderless/src/numeric/index.ts:124-127
Timestamp: 2024-12-02T08:56:05.176Z
Learning: 在`packages/renderless/src/numeric/index.ts`文件中,在访问`props.step.value`之前,应先判断`props.step`是否为对象,以确保容错处理。

Applied to files:

  • packages/renderless/src/file-upload/index.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)

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.

@discreted66 discreted66 force-pushed the lk-1111 branch 2 times, most recently from 9a3c4d1 to 8e0eec3 Compare November 13, 2025 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant