mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Don't re-download the sent text file.
This commit is contained in:
@@ -19,8 +19,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/history_item.h"
|
||||
#include "history/history.h"
|
||||
#include "core/file_location.h"
|
||||
#include "core/application.h"
|
||||
#include "core/mime_type.h"
|
||||
#include "main/main_session.h"
|
||||
#include "storage/storage_account.h"
|
||||
#include "apiwrap.h"
|
||||
|
||||
namespace Storage {
|
||||
@@ -331,6 +333,20 @@ void Uploader::upload(
|
||||
}
|
||||
if (!file->filepath.isEmpty()) {
|
||||
document->setLocation(Core::FileLocation(file->filepath));
|
||||
} else if (!file->content.isEmpty()
|
||||
&& Core::App().canSaveFileWithoutAskingForPath()) {
|
||||
const auto path = DocumentFileNameForSave(document);
|
||||
if (!path.isEmpty()) {
|
||||
auto f = QFile(path);
|
||||
if (f.open(QIODevice::WriteOnly)
|
||||
&& f.write(file->content) == file->content.size()) {
|
||||
f.close();
|
||||
document->setLocation(Core::FileLocation(path));
|
||||
session().local().writeFileLocation(
|
||||
document->mediaKey(),
|
||||
Core::FileLocation(path));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (file->type == SendMediaType::ThemeFile) {
|
||||
document->checkWallPaperProperties();
|
||||
|
||||
Reference in New Issue
Block a user