Hello,
We found a problem while uploading attachments. In our database, it is found that the same digest value is being added to multiple documents. Upon further debugging, the identical part is “Length”. The length value is the same for all of these attachments.
So we ran a quick test, uploading the same PDF to different documents,
- With the same attachment name
- with changing the attachment name
- By changing the file name that we are uploading(local file name)
Note: The PDF content and size are the same in all the 4 uploads we made.
It is found that the digest value is the same.
[
{
"_attachment": {
"test": {
"content_type": "application/pdf",
"digest": "sha1-zv/cBdnt8CPCRoDYO0vO5PUz5aI=",
"length": 119154,
"revpos": 2,
"stub": true
}
},
"_id": "87e1415cb73bb77c74420d990ceb93a6",
"_rev": "2-1f049fb3f45563b4bac6524d379899e6",
"createdAt": "2022-09-09T00:00:00Z",
"type": "attachment_test"
},
{
"_attachment": {
"test": {
"content_type": "application/pdf",
"digest": "sha1-zv/cBdnt8CPCRoDYO0vO5PUz5aI=",
"length": 119154,
"revpos": 2,
"stub": true
}
},
"_id": "c385169726ea24a2c30e88be6333b28a",
"_rev": "2-2a0a5e76ae1cfeeab9f702c9cd2b0007",
"createdAt": "2022-09-07T00:00:00Z",
"type": "attachment_test"
},
{
"_attachment": {
"test2": {
"content_type": "application/pdf",
"digest": "sha1-zv/cBdnt8CPCRoDYO0vO5PUz5aI=",
"length": 119154,
"revpos": 2,
"stub": true
}
},
"_id": "da2e04dfcad62c3d0fdc864b6f68f8ed",
"_rev": "2-2a0a5e76ae1cfeeab9f702c9cd2b0007",
"createdAt": "2022-09-07T00:00:00Z",
"type": "attachment_test"
},
{
"_attachment": {
"test3": {
"content_type": "application/pdf",
"digest": "sha1-zv/cBdnt8CPCRoDYO0vO5PUz5aI=",
"length": 119154,
"revpos": 2,
"stub": true
}
},
"_id": "ca6ddfc149c189f46c40464347768fcd",
"_rev": "2-2a0a5e76ae1cfeeab9f702c9cd2b0007",
"createdAt": "2022-09-07T00:00:00Z",
"type": "attachment_test"
}
]
We are trying to understand how the digest is generated.
- Is it based on length?
- or the content of the BLOB?
Thanks,
Pavan.