From 8accfb5d07742c04c1446f6de9195feda1f52b05 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Mon, 18 Jan 2021 15:01:21 +0100 Subject: [PATCH] Add workaround for issue discovered in https://github.com/owncloud/core/pull/38304 --- src/common/checksums.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/checksums.cpp b/src/common/checksums.cpp index aceb4cb3608..7363f8a31ac 100644 --- a/src/common/checksums.cpp +++ b/src/common/checksums.cpp @@ -153,8 +153,13 @@ QByteArray findBestChecksum(const QByteArray &_checksums) || -1 != (i = checksums.indexOf(QLatin1String("MD5:"), Qt::CaseInsensitive)) || -1 != (i = checksums.indexOf(QLatin1String("ADLER32:"), 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();