nextcloud-desktop/src/libsync/helpers.cpp
Andy Scherzinger 130668c3b9
docs(reuse): Migrate to SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2025-04-29 09:00:19 +02:00

29 lines
695 B
C++

/*
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "helpers.h"
namespace OCC
{
QByteArray parseEtag(const char *header)
{
if (!header) {
return {};
}
QByteArray result = header;
// Weak E-Tags can appear when gzip compression is on, see #3946
if (result.startsWith("W/")) {
result = result.mid(2);
}
// https://github.com/owncloud/client/issues/1195
result.replace("-gzip", "");
if (result.length() >= 2 && result.startsWith('"') && result.endsWith('"')) {
result = result.mid(1, result.length() - 2);
}
return result;
}
} // namespace OCC