Skip to content

Commit

Permalink
Add workaround for issue discovered in owncloud/core#38304
Browse files Browse the repository at this point in the history
  • Loading branch information
TheOneRing authored and mgallien committed Aug 9, 2021
1 parent f5b81f5 commit cf63303
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/common/checksums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,13 @@ QByteArray findBestChecksum(const QByteArray &_checksums)
|| -1 != (i = checksums.indexOf(QLatin1String("MD5:"), 0, Qt::CaseInsensitive))
|| -1 != (i = checksums.indexOf(QLatin1String("ADLER32:"), 0, Qt::CaseInsensitive))) {
// Now i is the start of the best checksum
// Grab it until the next space or end of string.
return _checksums.mid(i, _checksums.indexOf(' ', i) - i);
// Grab it until the next space or end of xml or end of string.
int end = _checksums.indexOf(' ', i);
// workaround for https://github.com/owncloud/core/pull/38304
if (end == -1) {
end = _checksums.indexOf('<', i);
}
return _checksums.mid(i, end - i);
}
qCWarning(lcChecksums) << "Failed to parse" << _checksums;
return QByteArray();
Expand Down

0 comments on commit cf63303

Please sign in to comment.