From 5999847bceafeac41ce4a73ef01c7f4e945a4a0e Mon Sep 17 00:00:00 2001 From: mnovak Date: Tue, 17 Nov 2026 13:12:53 +0100 Subject: [PATCH] [protocol] Archive: the release's own root (./) is an allowed directory entry --- crates/protocol/src/archive.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/protocol/src/archive.rs b/crates/protocol/src/archive.rs index 6a1a901..5f79dfe 100644 --- a/crates/protocol/src/archive.rs +++ b/crates/protocol/src/archive.rs @@ -52,7 +52,7 @@ impl ArchiveError { } } -/// Check one entry and return its path as plain components (no `.`, never empty). +/// Check one entry and return its path as plain components (no `.`; empty only for the root dir). pub fn check_entry(kind: EntryKind, path: &str, size: u64) -> Result, ArchiveError> { match kind { EntryKind::File | EntryKind::Dir => {} @@ -78,7 +78,9 @@ pub fn check_entry(kind: EntryKind, path: &str, size: u64) -> Result c => parts.push(c.to_owned()), } } - if parts.is_empty() { + // The release's own root (`./`, as `tar -C dir -czf x .` writes it) names nothing: allowed for a + // directory, refused for anything else. + if parts.is_empty() && kind != EntryKind::Dir { return Err(ArchiveError::Path); } Ok(parts)