mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 23:00:58 +00:00
Handle LOCATION_INVALID error.
This commit is contained in:
parent
1ae3af0e80
commit
f7aadc352b
@ -282,6 +282,8 @@ auto ApiWrap::fileRequest(const Data::FileLocation &location, int offset) {
|
||||
filePartDone(0, MTP_upload_file(MTP_storage_filePartial(),
|
||||
MTP_int(0),
|
||||
MTP_bytes(QByteArray())));
|
||||
} else if (result.type() == qstr("LOCATION_INVALID")) {
|
||||
filePartUnavailable();
|
||||
} else {
|
||||
error(std::move(result));
|
||||
}
|
||||
@ -558,8 +560,11 @@ void ApiWrap::requestOtherData(
|
||||
void ApiWrap::otherDataDone(const QString &relativePath) {
|
||||
Expects(_otherDataProcess != nullptr);
|
||||
|
||||
_otherDataProcess->file.relativePath = relativePath;
|
||||
const auto process = base::take(_otherDataProcess);
|
||||
process->file.relativePath = relativePath;
|
||||
if (relativePath.isEmpty()) {
|
||||
process->file.skipReason = Data::File::SkipReason::Unavailable;
|
||||
}
|
||||
process->done(std::move(process->file));
|
||||
}
|
||||
|
||||
@ -696,6 +701,9 @@ void ApiWrap::loadUserpicDone(const QString &relativePath) {
|
||||
const auto index = _userpicsProcess->fileIndex;
|
||||
auto &file = _userpicsProcess->slice->list[index].image.file;
|
||||
file.relativePath = relativePath;
|
||||
if (relativePath.isEmpty()) {
|
||||
file.skipReason = Data::File::SkipReason::Unavailable;
|
||||
}
|
||||
loadNextUserpic();
|
||||
}
|
||||
|
||||
@ -1139,7 +1147,11 @@ void ApiWrap::loadMessageFileDone(const QString &relativePath) {
|
||||
&& (_chatProcess->fileIndex < _chatProcess->slice->list.size()));
|
||||
|
||||
const auto index = _chatProcess->fileIndex;
|
||||
_chatProcess->slice->list[index].file().relativePath = relativePath;
|
||||
auto &file = _chatProcess->slice->list[index].file();
|
||||
file.relativePath = relativePath;
|
||||
if (relativePath.isEmpty()) {
|
||||
file.skipReason = Data::File::SkipReason::Unavailable;
|
||||
}
|
||||
loadNextMessageFile();
|
||||
}
|
||||
|
||||
@ -1352,6 +1364,15 @@ void ApiWrap::filePartDone(int offset, const MTPupload_File &result) {
|
||||
process->done(process->relativePath);
|
||||
}
|
||||
|
||||
void ApiWrap::filePartUnavailable() {
|
||||
Expects(_fileProcess != nullptr);
|
||||
Expects(!_fileProcess->requests.empty());
|
||||
|
||||
LOG(("Export Error: File unavailable."));
|
||||
|
||||
base::take(_fileProcess)->done(QString());
|
||||
}
|
||||
|
||||
void ApiWrap::error(RPCError &&error) {
|
||||
_errors.fire(std::move(error));
|
||||
}
|
||||
|
@ -167,6 +167,7 @@ private:
|
||||
FnMut<void(QString)> done);
|
||||
void loadFilePart();
|
||||
void filePartDone(int offset, const MTPupload_File &result);
|
||||
void filePartUnavailable();
|
||||
|
||||
template <typename Request>
|
||||
[[nodiscard]] auto mainRequest(Request &&request);
|
||||
|
Loading…
Reference in New Issue
Block a user