fix(desktop): recognize empty ZIP state views

This commit is contained in:
wunianze666-netizen committed 2026-11-08 14:45:11 +08:00
1 parent 2ac8578827
commit 263b25bd34
9 files changed
+193 -26

No files matched your search

+10 -10
View File
@@ -64,16 +64,16 @@ Views hold the captured bytes as they are, the capture host's name and user
included; the export removes those from the bundle. A version records
whether the file was present, the SHA-256 of its retained bytes, and a view:
| Format | Detected by | View |
| --------- | ---------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `sqlite` | The `SQLite format 3` header | Every ordinary table's columns, primary key and up to 500 rows |
| `dconf` | The `GVariant` header | Groups whose path names the application, plus the names of the other groups |
| `zip` | A zip local file header, `PK\x03\x04`, whatever the name | Its file entries in archive order, each with its own format and view |
| `json` | A `.json` name or a leading `{` or `[` that parses | The parsed value, from files up to 4 MiB nested up to 500 levels |
| `xml` | An XML name or declaration that parses | An element tree (`name`, `attributes`, `children`); text kept exactly, DTDs never read |
| `keyfile` | Only `[group]`, `key=value` and comment lines, with at least one group | Groups of `key` → string value, from files up to 4 MiB |
| `text` | Other UTF-8 text | Lines, up to 5,000 |
| `binary` | NUL bytes or invalid UTF-8 | None |
| Format | Detected by | View |
| --------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
| `sqlite` | The `SQLite format 3` header | Every ordinary table's columns, primary key and up to 500 rows |
| `dconf` | The `GVariant` header | Groups whose path names the application, plus the names of the other groups |
| `zip` | A zip local file header or an empty classic/Zip64 archive signature, whatever the name | Its file entries in archive order, each with its own format and view |
| `json` | A `.json` name or a leading `{` or `[` that parses | The parsed value, from files up to 4 MiB nested up to 500 levels |
| `xml` | An XML name or declaration that parses | An element tree (`name`, `attributes`, `children`); text kept exactly, DTDs never read |
| `keyfile` | Only `[group]`, `key=value` and comment lines, with at least one group | Groups of `key` → string value, from files up to 4 MiB |
| `text` | Other UTF-8 text | Lines, up to 5,000 |
| `binary` | NUL bytes or invalid UTF-8 | None |
A JSON value holding a number JavaScript would round, such as an integer above
2^53, is not read rather than shown rounded.
@@ -1,6 +1,7 @@
# Plan
1. Format and reader: `zip` detected by its local file header; the text, JSON,
1. Format and reader: `zip` detected by its local file header or an empty
classic/Zip64 archive signature; the text, JSON,
key file and XML readers shared as `textualView`, so a file and an entry
read alike; a domain module for the entry limits, the entry view and the
archive view, and an application reader that walks the verified bytes with
@@ -13,8 +13,9 @@ evaluators, REA's and the exported verifier's, agree.
## Requirements
- Format: a file starting with a zip local file header (`PK\x03\x04`) is
`zip`, whatever its name. Its view is
- Format: a file starting with a zip local file header (`PK\x03\x04`), or
a classic/Zip64 empty-archive signature with at least 22 bytes, is `zip`,
whatever its name. A signature is not proof of directory validity. Its view is
`{entries, entry_count, truncated}`: the file entries in archive order,
directories left out, each `{name, size, sha256, format, view, view_error}`.
- Reading: from the retained bytes already checked against their digest, in
@@ -33,8 +33,8 @@ generation reads the kinds of change.
with exact numbers; XML through the shared strict parser, a DOCTYPE read
only when it has no internal subset and its DTD never read
([XML text checks](../xml-text-checks/spec.md)); key files up to 4 MiB
whose every line parses; zip archives by
their local file header, as their entries with each entry's own format and
whose every line parses; zip archives by their local file header or a
classic/Zip64 empty-archive signature, as entries with each entry's own format and
view ([document views](../document-views/spec.md)); text; binary.
- Changes between versions are created, deleted, or lines, values, keys or
rows with added, removed and changed lists (100 each, with counts); content