FileManager: bugfixes

GitOrigin-RevId: c8b289a23ea898fa1772d0184b66b813dcbfe760
This commit is contained in:
Arseny Smirnov 2019-01-20 18:26:51 +03:00
parent 9f6d9ec48c
commit d9f51ffb77
2 changed files with 13 additions and 5 deletions

View File

@ -279,6 +279,13 @@ class FullRemoteFileLocation {
friend StringBuilder &operator<<(StringBuilder &string_builder, friend StringBuilder &operator<<(StringBuilder &string_builder,
const FullRemoteFileLocation &full_remote_file_location); const FullRemoteFileLocation &full_remote_file_location);
int32 key_type() const {
auto type = static_cast<int32>(file_type_);
if (is_web()) {
type |= WEB_LOCATION_FLAG;
}
return type;
}
int32 full_type() const { int32 full_type() const {
auto type = static_cast<int32>(file_type_); auto type = static_cast<int32>(file_type_);
if (is_web()) { if (is_web()) {
@ -350,7 +357,7 @@ class FullRemoteFileLocation {
template <class StorerT> template <class StorerT>
void store(StorerT &storer) const { void store(StorerT &storer) const {
using td::store; using td::store;
store(key.full_type(), storer); store(key.key_type(), storer);
key.variant_.visit([&](auto &&value) { key.variant_.visit([&](auto &&value) {
using td::store; using td::store;
store(value.as_key(), storer); store(value.as_key(), storer);
@ -521,8 +528,8 @@ class FullRemoteFileLocation {
} }
bool operator<(const FullRemoteFileLocation &other) const { bool operator<(const FullRemoteFileLocation &other) const {
if (full_type() != other.full_type()) { if (key_type() != other.key_type()) {
return full_type() < other.full_type(); return key_type() < other.key_type();
} }
if (dc_id_ != other.dc_id_) { if (dc_id_ != other.dc_id_) {
return dc_id_ < other.dc_id_; return dc_id_ < other.dc_id_;
@ -541,7 +548,7 @@ class FullRemoteFileLocation {
} }
} }
bool operator==(const FullRemoteFileLocation &other) const { bool operator==(const FullRemoteFileLocation &other) const {
if (full_type() != other.full_type()) { if (key_type() != other.key_type()) {
return false; return false;
} }
if (dc_id_ != other.dc_id_) { if (dc_id_ != other.dc_id_) {

View File

@ -146,7 +146,8 @@ void FileNode::set_remote_location(const RemoteFileLocation &remote, FileLocatio
} }
if (remote_ == remote) { if (remote_ == remote) {
if (remote_.type() == RemoteFileLocation::Type::Full) { if (remote_.type() == RemoteFileLocation::Type::Full) {
if (remote_.full().get_access_hash() == remote.full().get_access_hash()) { if (remote_.full().get_access_hash() == remote.full().get_access_hash() &&
remote_.full().has_file_reference() == remote.full().has_file_reference()) {
return; return;
} }
} else { } else {