No need to compute base at each loop run
authorKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 7 Jul 2020 14:43:55 +0000 (16:43 +0200)
committerKevin Ottens (Rebase PR Action) <er-vin@users.noreply.github.com>
Tue, 7 Jul 2020 15:51:24 +0000 (15:51 +0000)
Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
src/libsync/clientsideencryptionjobs.cpp

index afd7df08df5b597bab0eae5fd6a5b0ea776caf74..1f8a65a7c15776c2faaa618c4ddd31483371e853 100644 (file)
@@ -74,6 +74,9 @@ bool GetFolderEncryptStatusJob::finished()
             </d:response>
           </d:multistatus>
         */
+        QString base = account()->url().path();
+        if (base.endsWith(QLatin1Char('/')))
+            base.chop(1);
 
         QString currFile;
         int currEncryptedStatus = -1;
@@ -83,10 +86,6 @@ bool GetFolderEncryptStatusJob::finished()
             if (type == QXmlStreamReader::StartElement) {
                 if (reader.name() == QLatin1String("href")) {
                     // If the current file is not a folder, ignore it.
-                    QString base = account()->url().path();
-                    if (base.endsWith(QLatin1Char('/')))
-                        base.chop(1);
-
                     currFile = reader.readElementText(QXmlStreamReader::SkipChildElements);
                     currFile.remove(base + QLatin1String("/remote.php/webdav/"));
                     if (!currFile.endsWith('/'))