if (!header)
return QByteArray();
QByteArray arr = header;
- arr.replace("-gzip", ""); // https://github.comowncloud/client/issues/1195
+
+ // Weak E-Tags can appear when gzip compression is on, see #3946
+ if (arr.startsWith("W/"))
+ arr = arr.mid(2);
+
+ // https://github.com/owncloud/client/issues/1195
+ arr.replace("-gzip", "");
+
if(arr.length() >= 2 && arr.startsWith('"') && arr.endsWith('"')) {
arr = arr.mid(1, arr.length() - 2);
}
#include <QDebug>
#include "propagatedownload.h"
+#include "owncloudpropagator_p.h"
using namespace OCC;
namespace OCC {
QVERIFY( tmpFileName.length() <= 254);
}
}
+
+ void testParseEtag()
+ {
+ typedef QPair<const char*, const char*> Test;
+ QList<Test> tests;
+ tests.append(Test("\"abcd\"", "abcd"));
+ tests.append(Test("\"\"", ""));
+ tests.append(Test("\"fii\"-gzip", "fii"));
+ tests.append(Test("W/\"foo\"", "foo"));
+
+ foreach (const auto& test, tests) {
+ QCOMPARE(parseEtag(test.first), test.second);
+ }
+ }
};
#endif