mirror of
https://github.com/openai/codex.git
synced 2026-04-24 14:45:27 +00:00
Reject overwrite when share metadata missing
This commit is contained in:
@@ -146,18 +146,9 @@ pub async fn upload_rollout_with_owner(
|
||||
upload_meta(&store, &meta_key, &updated).await?;
|
||||
}
|
||||
(true, None) => {
|
||||
// Recover from a previous metadata upload failure by restoring metadata
|
||||
// and overwriting the rollout blob.
|
||||
let meta = SessionShareMeta {
|
||||
owner: owner.to_string(),
|
||||
created_at: now,
|
||||
updated_at: now,
|
||||
};
|
||||
upload_meta(&store, &meta_key, &meta).await?;
|
||||
store
|
||||
.put_object(&key, data, "application/x-ndjson")
|
||||
.await
|
||||
.with_context(|| format!("failed to upload rollout for id {session_id}"))?;
|
||||
return Err(anyhow::anyhow!(
|
||||
"remote session already exists but has no metadata; refusing to overwrite"
|
||||
));
|
||||
}
|
||||
(false, Some(meta)) => {
|
||||
if meta.owner != owner {
|
||||
|
||||
@@ -126,7 +126,7 @@ fn cargo_target_dir() -> Result<PathBuf, CargoBinError> {
|
||||
|
||||
fn absolutize_from_buck_or_cwd(path: PathBuf) -> Result<PathBuf, CargoBinError> {
|
||||
path.absolutize()
|
||||
.map(|abs| abs.into_owned())
|
||||
.map(std::borrow::Cow::into_owned)
|
||||
.map_err(|source| CargoBinError::CurrentDir { source })
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user