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")
|
||||
.map_err(client_error)?;
|
||||
|
||||
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)?;
|
||||
|
||||
if merged_content == existing_version.content {
|
||||
if content_bytes == existing_version.content {
|
||||
info!(
|
||||
"Content of the new version is the same as the existing version. Not creating a \
|
||||
new version."
|
||||
|
|
@ -82,6 +74,14 @@ pub async fn create_document(
|
|||
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 {
|
||||
vault_id,
|
||||
vault_update_id: last_update_id + 1,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue