Add temporary reuse_uploaded_photos_by_hash option.

GitOrigin-RevId: 99fc8dae067322c51ad489f50d60979f62fa4213
This commit is contained in:
levlam 2020-10-30 16:01:43 +03:00
parent 6f4c4adcc8
commit 5719636fa2
2 changed files with 7 additions and 1 deletions

View File

@ -7289,6 +7289,12 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
return;
}
break;
case 'r':
// temporary option
if (set_boolean_option("reuse_uploaded_photos_by_hash")) {
return;
}
break;
case 's':
if (set_integer_option("session_count", 0, 50)) {
return;

View File

@ -3079,7 +3079,7 @@ Result<FileId> FileManager::get_input_file_id(FileType type, const tl_object_ptr
return FileId();
}
string hash;
if (false && new_type == FileType::Photo) {
if (G()->shared_config().get_option_boolean("reuse_uploaded_photos_by_hash") && new_type == FileType::Photo) {
auto r_stat = stat(path);
if (r_stat.is_ok() && r_stat.ok().size_ > 0 && r_stat.ok().size_ < 5000000) {
auto r_file_content = read_file_str(path, r_stat.ok().size_);