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

Đang mở Phù hợp với người mới
#163 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
javascript
Lĩnh vực
data-visualization

Hướng nghiên cứu

Đọc packages/pivotkit-core/src/xlsx.js quanh dòng 250 và kiểm tra các tùy chọn zip của fflate cho trường thời gian sửa đổi. Thêm tùy chọn modified vào toXlsx và truyền tùy chọn này cho từng mục zip; dùng một ngày cố định trong các bài kiểm thử. Hoàn tất khi các lần gọi lặp lại với cùng một lưới và thời gian sửa đổi tạo ra các byte tệp giống hệt nhau, trong khi nội dung sổ làm việc vẫn không thay đổi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
JavaScript
Star
1
Fork
1
Merge trung bình
3 giờ 34 phút
Pull request đã merge (30 ngày)
213

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của eizedev/pivotkit

Tất cả issue của eizedev/pivotkit

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.