╭ changed ───────────╮ │src/serve_common.zig│ ╰────────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────╮ │ 9 not_found, // unknown owner, or the repo doesn't exist and we aren't creating│ │10 }; │ │11 │ │12 -// resolve a requested repo path to its on-disk directory. in test mode the path │ │13 -// is served directly; otherwise it's resolved as <owner>/<repo> through the │ │14 -// event store, minting a repo event for a fresh push. │ │12 +// resolve a requested repo path to its on-disk directory, parsed as │ │13 +// <owner>/<repo> through the event store, minting a repo event for a fresh push.│ │14 pub fn resolveRepoPath( │ │15 io: std.Io, │ │16 allocator: std.mem.Allocator, │ ╰─────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────╮ │18 - is_test: bool, │ │17 repo_root_path: []const u8, │ │18 admin_repo_path: []const u8,│ │19 requested: []const u8, │ ╰────────────────────────────────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │20 create_if_missing: bool, │ │21 ) !RepoPath { │ │24 - // the networking tests address repos by a trusted on-disk path (an absolute │ │25 - // `requested` discards repo_root), so no traversal check is needed here │ │26 - if (is_test) { │ │27 - return .{ .ok = try std.fs.path.resolve(allocator, &.{ repo_root_path, requested }) }; │ │28 - } │ │29 - │ │22 const owner_repo = evt.parseOwnerRepoPath(requested) orelse return .invalid; │ │23 const event_id_hex = (try evt.resolveOrCreateRepo(io, allocator, admin_repo_path, owner_repo.owner, owner_repo.name, create_if_missing)) orelse return .not_found;│ │24 return .{ .ok = try std.fs.path.join(allocator, &.{ repo_root_path, &event_id_hex }) }; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯