From bc08199ef1f9419b5b8ed4165458783314934266 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 11 Apr 2026 13:39:49 +0200 Subject: [PATCH] crypto TLS bundle: make AddCertsFromDirPathError compile It's calling `addCertsFromDir`, which now requires a timestamp, so it didn't compile any more. Add a test by the way. --- lib/std/crypto/Certificate/Bundle.zig | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/std/crypto/Certificate/Bundle.zig b/lib/std/crypto/Certificate/Bundle.zig index 072d408143..0d13d8e9ab 100644 --- a/lib/std/crypto/Certificate/Bundle.zig +++ b/lib/std/crypto/Certificate/Bundle.zig @@ -184,7 +184,8 @@ pub fn addCertsFromDirPath( ) AddCertsFromDirPathError!void { var iterable_dir = try dir.openDir(io, sub_dir_path, .{ .iterate = true }); defer iterable_dir.close(io); - return addCertsFromDir(cb, gpa, io, iterable_dir); + const now = Io.Clock.real.now(io); + return addCertsFromDir(cb, gpa, io, now, iterable_dir); } pub fn addCertsFromDirPathAbsolute( @@ -331,6 +332,19 @@ const MapContext = struct { } }; +test "addCertsFromDirPath compiles and accepts an empty directory" { + const io = std.testing.io; + const gpa = std.testing.allocator; + + var tmp = std.testing.tmpDir(.{ .iterate = true }); + defer tmp.cleanup(); + + var bundle: Bundle = .empty; + defer bundle.deinit(gpa); + + try bundle.addCertsFromDirPath(gpa, io, tmp.dir, "."); +} + test "scan for OS-provided certificates" { if (builtin.os.tag == .wasi) return error.SkipZigTest;