From 1a927e4233222d6587d684b15cac2ca37ccea106 Mon Sep 17 00:00:00 2001 From: Theo Paris Date: Thu, 7 Sep 2023 16:53:43 -0700 Subject: [PATCH] fix: package hash bug This is not the best fix as it duplicates code. --- src/Package.zig | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Package.zig b/src/Package.zig index 9f1836020198..754541652c13 100644 --- a/src/Package.zig +++ b/src/Package.zig @@ -608,6 +608,20 @@ fn fetchAndUnpack( // I have not checked what buffer sizes the xz decompression implementation uses // by default, so the same logic applies for buffering the reader as for gzip. try unpackTarball(gpa, prog_reader.reader(), tmp_directory.handle, std.compress.xz); + + tmp_directory = d: { + const path = try global_cache_directory.join(gpa, &.{tmp_dir_sub_path}); + errdefer gpa.free(path); + + const iterable_dir = try global_cache_directory.handle.makeOpenPathIterable(tmp_dir_sub_path, .{}); + errdefer iterable_dir.close(); + + break :d .{ + .path = path, + .handle = iterable_dir.dir, + }; + }; + defer tmp_directory.closeAndFree(gpa); } else if (ascii.eqlIgnoreCase(content_type, "application/octet-stream")) { // support gitlab tarball urls such as https://gitlab.com///-/archive//-.tar.gz // whose content-disposition header is: 'attachment; filename="-.tar.gz"'