summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 10:36:27 -0300
committerGabriel Schneider <[email protected]>2026-10-01 10:46:01 -0300
commit860796aa8832bb9bf32b2770bc0584b962bb51b7 (patch)
tree3cbfcec1aa2fb8b652a9436a0b9a2613352918ca /src
parentedad6d960dc0fc1165cbb3b801e0538045b2247f (diff)
downloadpardes-860796aa8832bb9bf32b2770bc0584b962bb51b7.tar.gz
pardes-860796aa8832bb9bf32b2770bc0584b962bb51b7.zip
A dump no longer embeds a picture or a PDF that is on disk: Restore reads it from there, as a clean file's text is
Every Dump carried each image's and PDF's bytes in base64 (a 900 KB PDF made a 1.3 MB dump), and a Restore showed that copy however the file had changed. One on disk now goes by its path alone; one not on disk (no file behind it) still has its bytes kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/image.zig8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/image.zig b/src/image.zig
index 9f635d1c..324d445f 100644
--- a/src/image.zig
+++ b/src/image.zig
@@ -855,8 +855,12 @@ pub fn dumpPane(
path: []const u8,
raw: []const u8,
) !dump.Pane {
- const bytes = if (raw.len > 0) raw else filesystem.read(p, path) catch &.{};
- defer if (raw.len == 0) p.gpa.free(bytes);
+ // A picture or PDF on disk is read from there at Restore, as a clean
+ // file's text is: the dump keeps only the bytes of one that is not
+ // (megabytes of a PDF per dump, and a stale copy, otherwise).
+ _ = p;
+ const on_disk = if (filesystem.localPath(path)) |local| @import("exec.zig").kindOf(local) == .file else false;
+ const bytes: []const u8 = if (on_disk) &.{} else raw;
return .{
.kind = .image,
.tag = tag,