[protocol] Archive: the release's own root (./) is an allowed directory entry
This commit is contained in:
@@ -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<Vec<String>, ArchiveError> {
|
||||
match kind {
|
||||
EntryKind::File | EntryKind::Dir => {}
|
||||
@@ -78,7 +78,9 @@ pub fn check_entry(kind: EntryKind, path: &str, size: u64) -> Result<Vec<String>
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user