fix: preserve documents on repeat create
This commit is contained in:
parent
f7f12480d0
commit
6fc1410e65
3 changed files with 25 additions and 4 deletions
|
|
@ -7754,6 +7754,11 @@ pub fn handle_request(
|
|||
ControlRequest::DocumentCreate { name } => {
|
||||
geth_document::validate_document_name(&name)
|
||||
.map_err(|_| NodeError::InvalidDocumentName(name.clone()))?;
|
||||
if let Some(existing) = store.get_document_resource_by_name(&name)? {
|
||||
return Ok(ControlResponse::DocumentCreated {
|
||||
document: document_resource_from_stored(&existing),
|
||||
});
|
||||
}
|
||||
let resource_id = format!("resource:document:{name}");
|
||||
let document_id = format!("document:{name}");
|
||||
let resource = StoredResource {
|
||||
|
|
|
|||
Loading…
Reference in a new issue