No need to merge if the contents are equal
This commit is contained in:
parent
727b60c672
commit
b074202ed8
1 changed files with 9 additions and 9 deletions
|
|
@ -61,15 +61,7 @@ pub async fn create_document(
|
||||||
.context("Failed to decode base64 content in request")
|
.context("Failed to decode base64 content in request")
|
||||||
.map_err(client_error)?;
|
.map_err(client_error)?;
|
||||||
|
|
||||||
let merged_content = merge(
|
if content_bytes == existing_version.content {
|
||||||
&[], // the empty string is the first common parent of the two documents,
|
|
||||||
&existing_version.content,
|
|
||||||
&content_bytes,
|
|
||||||
)
|
|
||||||
.context("Failed to decode bytes as UTF-8")
|
|
||||||
.map_err(client_error)?;
|
|
||||||
|
|
||||||
if merged_content == existing_version.content {
|
|
||||||
info!(
|
info!(
|
||||||
"Content of the new version is the same as the existing version. Not creating a \
|
"Content of the new version is the same as the existing version. Not creating a \
|
||||||
new version."
|
new version."
|
||||||
|
|
@ -82,6 +74,14 @@ pub async fn create_document(
|
||||||
return Ok(Json(existing_version.into()));
|
return Ok(Json(existing_version.into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let merged_content = merge(
|
||||||
|
&[], // the empty string is the first common parent of the two documents,
|
||||||
|
&existing_version.content,
|
||||||
|
&content_bytes,
|
||||||
|
)
|
||||||
|
.context("Failed to decode bytes as UTF-8")
|
||||||
|
.map_err(client_error)?;
|
||||||
|
|
||||||
StoredDocumentVersion {
|
StoredDocumentVersion {
|
||||||
vault_id,
|
vault_id,
|
||||||
vault_update_id: last_update_id + 1,
|
vault_update_id: last_update_id + 1,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue