Allow re-downloading failed media.

This commit is contained in:
John Preston 2019-01-21 10:49:44 +04:00
parent e209299af4
commit 805e4d01e7
2 changed files with 4 additions and 3 deletions

View File

@ -379,7 +379,8 @@ void DocumentOpenClickHandler::Open(
return; return;
} }
if (data->status != FileReady) return; if (data->status != FileReady
&& data->status != FileDownloadFailed) return;
QString filename; QString filename;
if (!data->saveToCache() if (!data->saveToCache()

View File

@ -945,7 +945,7 @@ int mtpFileLoader::finishSentRequestGetOffset(mtpRequestId requestId) {
bool mtpFileLoader::feedPart(int offset, bytes::const_span buffer) { bool mtpFileLoader::feedPart(int offset, bytes::const_span buffer) {
Expects(!_finished); Expects(!_finished);
if (buffer.size()) { if (!buffer.empty()) {
if (_fileIsOpen) { if (_fileIsOpen) {
auto fsize = _file.size(); auto fsize = _file.size();
if (offset < fsize) { if (offset < fsize) {
@ -978,7 +978,7 @@ bool mtpFileLoader::feedPart(int offset, bytes::const_span buffer) {
} }
} }
} }
if (!buffer.size() || (buffer.size() % 1024)) { // bad next offset if (buffer.empty() || (buffer.size() % 1024)) { // bad next offset
_lastComplete = true; _lastComplete = true;
} }
if (_sentRequests.empty() if (_sentRequests.empty()