You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Check whether the dictionary is the old attachment or not:staticboolisOldAttachment(Dict properties, DocContext *context) {
auto sk = context->sharedKeys();
if (properties.get(C4STR("digest"), sk) != nullptr &&
properties.get(C4STR("length"), sk) != nullptr &&
properties.get(C4STR("stub"), sk) != nullptr &&
properties.get(C4STR("revpos"), sk) != nullptr &&
properties.get(C4STR("content_type"), sk) != nullptr)
returntrue;
returnfalse;
}
This isn't going to work correctly.
An attachment isn't required to have a content_type property; the developer may not have set one.
Attachments only appear inside the top-level _attachments property. An object elsewhere in the document, with the above properties, isn't an attachment. It seems unlikely that this would happen, but maybe if someone were archiving old or conflicting versions of a doc inside a nested property?
The second point might be nit-picky, and it looks like it would complicate the calling code to have to know where in the document the properties Dict is, so maybe we can ignore it. But I wanted to point it out.
The text was updated successfully, but these errors were encountered:
I just saw this change in commit 6cc6e94:
This isn't going to work correctly.
content_type
property; the developer may not have set one._attachments
property. An object elsewhere in the document, with the above properties, isn't an attachment. It seems unlikely that this would happen, but maybe if someone were archiving old or conflicting versions of a doc inside a nested property?The second point might be nit-picky, and it looks like it would complicate the calling code to have to know where in the document the
properties
Dict is, so maybe we can ignore it. But I wanted to point it out.The text was updated successfully, but these errors were encountered: