diff --git a/td/telegram/files/FileLocation.h b/td/telegram/files/FileLocation.h index dd254319..919dd20f 100644 --- a/td/telegram/files/FileLocation.h +++ b/td/telegram/files/FileLocation.h @@ -92,12 +92,13 @@ struct PhotoRemoteFileLocation { struct AsKey { const PhotoRemoteFileLocation &key; + bool is_unique; template void store(StorerT &storer) const; }; - AsKey as_key() const { - return AsKey{*this}; + AsKey as_key(bool is_unique) const { + return AsKey{*this, is_unique}; } bool operator<(const PhotoRemoteFileLocation &other) const { @@ -128,7 +129,7 @@ struct WebRemoteFileLocation { template void store(StorerT &storer) const; }; - AsKey as_key() const { + AsKey as_key(bool /*is_unique*/) const { return AsKey{*this}; } @@ -159,7 +160,7 @@ struct CommonRemoteFileLocation { template void store(StorerT &storer) const; }; - AsKey as_key() const { + AsKey as_key(bool /*is_unique*/) const { return AsKey{*this}; } diff --git a/td/telegram/files/FileLocation.hpp b/td/telegram/files/FileLocation.hpp index a762ba48..252df2d1 100644 --- a/td/telegram/files/FileLocation.hpp +++ b/td/telegram/files/FileLocation.hpp @@ -68,7 +68,9 @@ void PhotoRemoteFileLocation::parse(ParserT &parser) { template void PhotoRemoteFileLocation::AsKey::store(StorerT &storer) const { using td::store; - store(key.id_, storer); + if (!is_unique) { + store(key.id_, storer); + } store(key.volume_id_, storer); store(key.local_id_, storer); } @@ -207,7 +209,7 @@ void FullRemoteFileLocation::AsKey::store(StorerT &storer) const { store(key.key_type(), storer); key.variant_.visit([&](auto &&value) { using td::store; - store(value.as_key(), storer); + store(value.as_key(false), storer); }); } @@ -252,7 +254,7 @@ void FullRemoteFileLocation::AsUnique::store(StorerT &storer) const { store(type, storer); key.variant_.visit([&](auto &&value) { using td::store; - store(value.as_key(), storer); + store(value.as_key(true), storer); }); }