commit cfde9303ff75322525746aa325026f0e12fb402c (tree)
parent b5d8966e05926c31b16cdd18ee324cf3b6381d51
Author: Ryan Liptak <squeek502@hotmail.com>
Date: Sun, 19 Apr 2026 16:17:34 -0700
Fetch: Fix zip fetching when cache directory doesn't have tmp dir
Fixes #31964
Diffstat:
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/Package/Fetch.zig b/src/Package/Fetch.zig
@@ -1512,7 +1512,19 @@ fn unzip(
.read = true,
}) catch |err| switch (err) {
error.PathAlreadyExists => continue,
- error.Canceled => return error.Canceled,
+ error.FileNotFound => {
+ cache_root.handle.createDir(io, prefix, .default_dir) catch |dir_err| switch (dir_err) {
+ error.Canceled => |e| return e,
+ // error.PathAlreadyExists is considered a failure here because
+ // it implies that the prefix is not a directory.
+ else => |e| return f.fail(
+ f.location_tok,
+ try eb.printString("failed to create temporary directory: {t}", .{e}),
+ ),
+ };
+ continue;
+ },
+ error.Canceled => |e| return e,
else => |e| return f.fail(
f.location_tok,
try eb.printString("failed to create temporary zip file: {t}", .{e}),
@@ -1525,7 +1537,7 @@ fn unzip(
var zip_file_writer = zip_file.writer(io, &zip_file_buffer);
_ = reader.streamRemaining(&zip_file_writer.interface) catch |err| switch (err) {
- error.ReadFailed => return error.ReadFailed,
+ error.ReadFailed => |e| return e,
error.WriteFailed => return f.fail(
f.location_tok,
try eb.printString("failed writing temporary zip file: {t}", .{err}),