2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fix file reference updating.

This commit is contained in:
John Preston
2019-03-25 12:56:56 +04:00
parent aa8f62da9d
commit 3f49796c43
2 changed files with 28 additions and 4 deletions

View File

@@ -762,7 +762,9 @@ void mtpFileLoader::makeRequest(int offset) {
MTP_int(offset),
MTP_int(limit)),
rpcDone(&mtpFileLoader::normalPartLoaded),
rpcFail(&mtpFileLoader::partFailed),
rpcFail(
&mtpFileLoader::normalPartFailed,
computeFileReference()),
shiftedDcId,
50);
}
@@ -785,6 +787,15 @@ MTPInputFileLocation mtpFileLoader::computeLocation() const {
MTP_string(QString()));
}
QByteArray mtpFileLoader::computeFileReference() const {
if (_location) {
return _location->fileReference();
} else if (_locationType == SecureFileLocation) {
return QByteArray();
}
return _fileReference;
}
void mtpFileLoader::requestMoreCdnFileHashes() {
Expects(!_finished);
@@ -1076,7 +1087,8 @@ void mtpFileLoader::partLoaded(int offset, bytes::const_span buffer) {
}
}
bool mtpFileLoader::partFailed(
bool mtpFileLoader::normalPartFailed(
QByteArray fileReference,
const RPCError &error,
mtpRequestId requestId) {
if (MTP::isDefaultHandledError(error)) {
@@ -1088,9 +1100,19 @@ bool mtpFileLoader::partFailed(
_origin,
this,
requestId,
_location ? _location->fileReference() : _fileReference);
fileReference);
return true;
}
return partFailed(error, requestId);
}
bool mtpFileLoader::partFailed(
const RPCError &error,
mtpRequestId requestId) {
if (MTP::isDefaultHandledError(error)) {
return false;
}
cancel(true);
return true;
}