mirror of https://github.com/procxx/kepka.git
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(),
|
filePartDone(0, MTP_upload_file(MTP_storage_filePartial(),
|
||||||
MTP_int(0),
|
MTP_int(0),
|
||||||
MTP_bytes(QByteArray())));
|
MTP_bytes(QByteArray())));
|
||||||
|
} else if (result.type() == qstr("LOCATION_INVALID")) {
|
||||||
|
filePartUnavailable();
|
||||||
} else {
|
} else {
|
||||||
error(std::move(result));
|
error(std::move(result));
|
||||||
}
|
}
|
||||||
|
@ -558,8 +560,11 @@ void ApiWrap::requestOtherData(
|
||||||
void ApiWrap::otherDataDone(const QString &relativePath) {
|
void ApiWrap::otherDataDone(const QString &relativePath) {
|
||||||
Expects(_otherDataProcess != nullptr);
|
Expects(_otherDataProcess != nullptr);
|
||||||
|
|
||||||
_otherDataProcess->file.relativePath = relativePath;
|
|
||||||
const auto process = base::take(_otherDataProcess);
|
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));
|
process->done(std::move(process->file));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,6 +701,9 @@ void ApiWrap::loadUserpicDone(const QString &relativePath) {
|
||||||
const auto index = _userpicsProcess->fileIndex;
|
const auto index = _userpicsProcess->fileIndex;
|
||||||
auto &file = _userpicsProcess->slice->list[index].image.file;
|
auto &file = _userpicsProcess->slice->list[index].image.file;
|
||||||
file.relativePath = relativePath;
|
file.relativePath = relativePath;
|
||||||
|
if (relativePath.isEmpty()) {
|
||||||
|
file.skipReason = Data::File::SkipReason::Unavailable;
|
||||||
|
}
|
||||||
loadNextUserpic();
|
loadNextUserpic();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1139,7 +1147,11 @@ void ApiWrap::loadMessageFileDone(const QString &relativePath) {
|
||||||
&& (_chatProcess->fileIndex < _chatProcess->slice->list.size()));
|
&& (_chatProcess->fileIndex < _chatProcess->slice->list.size()));
|
||||||
|
|
||||||
const auto index = _chatProcess->fileIndex;
|
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();
|
loadNextMessageFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1352,6 +1364,15 @@ void ApiWrap::filePartDone(int offset, const MTPupload_File &result) {
|
||||||
process->done(process->relativePath);
|
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) {
|
void ApiWrap::error(RPCError &&error) {
|
||||||
_errors.fire(std::move(error));
|
_errors.fire(std::move(error));
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,6 +167,7 @@ private:
|
||||||
FnMut<void(QString)> done);
|
FnMut<void(QString)> done);
|
||||||
void loadFilePart();
|
void loadFilePart();
|
||||||
void filePartDone(int offset, const MTPupload_File &result);
|
void filePartDone(int offset, const MTPupload_File &result);
|
||||||
|
void filePartUnavailable();
|
||||||
|
|
||||||
template <typename Request>
|
template <typename Request>
|
||||||
[[nodiscard]] auto mainRequest(Request &&request);
|
[[nodiscard]] auto mainRequest(Request &&request);
|
||||||
|
|
Loading…
Reference in New Issue