From b93862a9a8b6195b3f70627df411f756dc377f86 Mon Sep 17 00:00:00 2001 From: sdzx-1 Date: Tue, 2 Jun 2026 13:38:46 +0800 Subject: [PATCH] fix: resolve deleteTree AccessDenied on macOS --- build.zig.zon | 4 ++-- src/zs3.zig | 28 ++++++++-------------------- 2 files changed, 10 insertions(+), 22 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 102a429..8cec728 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -5,8 +5,8 @@ .minimum_zig_version = "0.16.0", .dependencies = .{ .zio = .{ - .url = "git+https://github.com/lalinsky/zio?ref=v0.11.0#53abdf9ce5e6279e29703a39180ce1cedd8ac4ca", - .hash = "zio-0.11.0-xHbVVEqQGwDz0MYoQ0j7Ke0Y9E_iZVe5eLAWK4gd9U0i", + .url = "git+https://github.com/lalinsky/zio#49218cd2de6b0987e13d61d3471ba3909e213333", + .hash = "zio-0.13.0-xHbVVJMrHQA3985UtC43b4fQaZtcw_jCWByOTYuaV9wl", }, .polyrole = .{ .url = "git+https://github.com/sdzx-1/polyrole.git#5c4f7cb527dc8d4098fd769a611678a79447546b", diff --git a/src/zs3.zig b/src/zs3.zig index 9b1495a..41e8579 100644 --- a/src/zs3.zig +++ b/src/zs3.zig @@ -1377,16 +1377,10 @@ pub fn handleAbortMultipart(io: Io, data_dir: []const u8, allocator: Allocator, const parts_dir = allocPrint(allocator, "{s}/.uploads/{s}", .{ data_dir, upload_id }); defer allocator.free(parts_dir); - Io.Dir.cwd().deleteTree(io, parts_dir) catch |err| switch (err) { - error.AccessDenied => { - //TODO: fix this in macos - //An AccessDined error occurs on macOS, and the reason for this is currently unclear. - }, - else => { - const error_resp = allocPrint(allocator, "AbortMultipartCleanupFailed: {t}", .{err}); - sendError(res, 500, error_resp, ""); - return err; - }, + Io.Dir.cwd().deleteTree(io, parts_dir) catch |err| { + const error_resp = allocPrint(allocator, "AbortMultipartCleanupFailed: {t}", .{err}); + sendError(res, 500, error_resp, ""); + return err; }; res.noContent(); @@ -1589,16 +1583,10 @@ pub fn handleCompleteMultipart(io: Io, data_dir: []const u8, allocator: Allocato // Close final file before stat + meta write final_file.close(io); - Io.Dir.cwd().deleteTree(io, parts_dir) catch |err| switch (err) { - error.AccessDenied => { - //TODO: fix this in macos - //An AccessDined error occurs on macOS, and the reason for this is currently unclear. - }, - else => { - const error_resp = allocPrint(allocator, "FailedToCleanupUploadDir: {t}", .{err}); - sendError(res, 500, error_resp, ""); - return err; - }, + Io.Dir.cwd().deleteTree(io, parts_dir) catch |err| { + const error_resp = allocPrint(allocator, "FailedToCleanupUploadDir: {t}", .{err}); + sendError(res, 500, error_resp, ""); + return err; }; var final_hash: [16]u8 = undefined;