fix(dataset): accept empty/single-row backup CSV import (#7491) - #7590
Merged
c121914yu merged 2 commits intoAug 25, 2026
Merged
Conversation
|
zhaotian1 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
When a dataset has no data rows (or a single chunk), the exporter (exportAll.ts / collection/export.ts) generates a header-only or one-line CSV. papaparse then emits a Delimiter/UndetectableDelimiter hint because it cannot infer the delimiter from multiple rows, which made parseDatasetImportFile reject valid backups with 'Invalid dataset import content'. Parse with skipEmptyLines: 'greedy' to skip that benign hint while still rejecting real structural errors (e.g. MissingQuotes).
skyzhao1223
force-pushed
the
fix/7491-dataset-empty-csv-import
branch
from
August 25, 2026 07:05
5ca01bb to
312ea2d
Compare
6 tasks
|
✅ Build and publish successful - Preview fastgpt Image: 🕒 Time: 2026-08-25 22:13:41 (UTC+8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
Issue #7491:知识库导出分块后,用模板导入和备份导入都失败(私有部署 4.14 / 4.15 均存在)。
根因
导出方(
projects/app/src/pages/api/core/dataset/exportAll.ts与collection/export.ts)在以下场景会生成只有表头(或仅一行数据)的 CSV:此时
papaparse无法从多行数据推断分隔符,会抛出Delimiter/UndetectableDelimiter的提示性错误(数据本身未损坏)。而parseDatasetImportFile将任何errors.length > 0一律视为内容非法直接 reject,导致这些导出的备份无法重新导入。修复
在
packages/service/core/dataset/importFile.ts的Papa.parse增加skipEmptyLines: 'greedy':UndetectableDelimiter提示性错误MissingQuotes引号未闭合)的拒绝行为测试
packages/service全量测试:330 文件 / 3897 测试通过,无回归