Notify even if pre-fetch etag header is empty
authorClaudio Cambra <claudio.cambra@nextcloud.com>
Tue, 6 Aug 2024 08:52:39 +0000 (16:52 +0800)
committerMatthieu Gallien <matthieu_gallien@yahoo.fr>
Thu, 12 Sep 2024 07:52:54 +0000 (09:52 +0200)
This prevents situations where the server does not provide an etag header. This would make the empty pre-fetch and empty post-fetch etag headers match, meaning notifications would never be notified

Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
src/gui/tray/notificationhandler.cpp

index 46e876b66a6972a0d2b54626c06f0986d94aa140..b2a9fc78b9b249af975da7c1a7b2697242311241 100644 (file)
@@ -81,7 +81,7 @@ void ServerNotificationHandler::slotNotificationsReceived(const QJsonDocument &j
     // In theory the server should five us a 304 Not Modified if there are no new notifications.
     // But in practice, the server doesn't always do that. So we need to compare the ETag headers.
     const auto postFetchEtagHeader = _accountState->notificationsEtagResponseHeader();
-    if (_preFetchEtagHeader == postFetchEtagHeader) {
+    if (!_preFetchEtagHeader.isEmpty() || _preFetchEtagHeader == postFetchEtagHeader) {
         qCInfo(lcServerNotification) << "Notifications ETag header is the same as before, no new notifications.";
         deleteLater();
         emit jobFinished();