diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index a9eb80f5d..89ec35569 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -1014,11 +1014,19 @@ static int merge_choose_remote_location(const FullRemoteFileLocation &x, int8 x_ return !x_ref; } if (x.get_raw_file_reference() != y.get_raw_file_reference()) { - return x_source < y_source; + if (x_source != y_source) { + return x_source < y_source; + } + // prefer newest among two server locations + return 0; } } if (x.get_access_hash() != y.get_access_hash()) { - return x_source < y_source; + if (x_source != y_source) { + return x_source < y_source; + } + // prefer newest among two server locations + return 0; } return 2; }