Add mtime only to absolute original_path.

GitOrigin-RevId: 379ab8f47b8f2e4e6bf930977bfae8e26cf5fc60
This commit is contained in:
levlam 2018-11-01 18:54:08 +03:00
parent ecaaae62ef
commit 1cb68fab96

View File

@ -698,11 +698,10 @@ Result<FileId> 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;