toXlsx: the same input gives a different file on every call (zip timestamps)

未关闭 适合新手
#163 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript

调研方向

阅读第 250 行附近的 packages/pivotkit-core/src/xlsx.js,并检查 fflate 中用于修改时间字段的 zip 选项。将 modified 选项添加到 toXlsx,并将其传递给每个 zip 条目;在测试中使用固定日期。完成标准是:使用相同网格和修改时间重复调用时,生成的文件字节完全相同,同时工作簿内容保持不变。

由索引模型根据 Issue 内容生成。

描述

area:core enhancement

toXlsx produces a different file on every call for the same input, because the zip entries carry the current time. A workbook can't be compared by hash, and a scheduled report sends a "changed" file even when the data did not change.

Where: packages/pivotkit-core/src/xlsx.js line 250 calls zipSync(zipped, { level: 6 }) without a modification time, so fflate stamps each entry with the time of the call.

Not affected: the workbook content. Unzipped, every entry is byte-identical between runs; Excel and other readers don't care about the timestamps. Nothing has broken so far because no test or feature compares whole files.

Reproduce: call toXlsx twice on the same grid, compare SHA-256 of the two results: they differ; compare the unzipped entries: they match.

Fix: an option such as toXlsx(grid, { modified }) (a Date) that is passed as mtime to every zip entry, with a fixed default in tests. Check fflate's zip options for the exact field before building it. The headless report runner would pass the run's fire time, so a rerun of the same report gives the same bytes.

Found while probing headless runtimes for scheduled reports.

主要语言
JavaScript
星标
1
派生
1
平均合并
3 小时 34 分钟
30 天内合并 PR
213

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

eizedev/pivotkit 的其他 Issue

查看 eizedev/pivotkit 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。