From 1cb68fab96acbd60cda51bfc8b9b95297c212ad9 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 1 Nov 2018 18:54:08 +0300 Subject: [PATCH] Add mtime only to absolute original_path. GitOrigin-RevId: 379ab8f47b8f2e4e6bf930977bfae8e26cf5fc60 --- td/telegram/files/FileManager.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index e36fe991..4ec68d6a 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -698,11 +698,10 @@ Result FileManager::register_generate(FileType file_type, FileLocationSo string original_path, string conversion, DialogId owner_dialog_id, int64 expected_size) { // add #mtime# into conversion - if (!original_path.empty() && conversion[0] != '#') { + if (!original_path.empty() && conversion[0] != '#' && PathView(original_path).is_absolute()) { auto r_stat = stat(original_path); uint64 mtime = r_stat.is_ok() ? r_stat.ok().mtime_nsec_ : 0; - auto new_conversion = PSTRING() << "#mtime#" << lpad0(to_string(mtime), 20) << '#' << conversion; - conversion = std::move(new_conversion); + conversion = PSTRING() << "#mtime#" << lpad0(to_string(mtime), 20) << '#' << conversion; } FileData data;