mirror of
https://github.com/openai/codex.git
synced 2026-11-08 20:40:33 +00:00
thread-store: reject directory rollout paths
This commit is contained in:
@@ -143,6 +143,25 @@ async fn resolve_requested_rollout_path(
|
||||
} else {
|
||||
rollout_path
|
||||
};
|
||||
match tokio::fs::metadata(path.as_path()).await {
|
||||
Ok(metadata) if metadata.is_dir() => {
|
||||
return Err(ThreadStoreError::InvalidRequest {
|
||||
message: format!(
|
||||
"failed to resolve rollout path `{}`: path is a directory",
|
||||
path.display()
|
||||
),
|
||||
});
|
||||
}
|
||||
Ok(metadata) if !metadata.is_file() => {
|
||||
return Err(ThreadStoreError::InvalidRequest {
|
||||
message: format!(
|
||||
"failed to resolve rollout path `{}`: path is not a file",
|
||||
path.display()
|
||||
),
|
||||
});
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let Some(path) = codex_rollout::existing_rollout_path(path.as_path()).await else {
|
||||
return Err(ThreadStoreError::InvalidRequest {
|
||||
message: format!(
|
||||
|
||||
Reference in New Issue
Block a user