[dolphin] Fix overlays when filename has a colon
authorNicolas Fella <nicolas.fella@gmx.de>
Sat, 21 Mar 2020 14:35:50 +0000 (15:35 +0100)
committerNicolas Fella <nicolas.fella@gmx.de>
Sat, 21 Mar 2020 14:38:27 +0000 (15:38 +0100)
When the filename contains a ':' it gets split too much and tokens[2] does not contain the full filename any more. Read the name from the original line instead.

Fixes #686

Signed-off-by: Nicolas Fella <nicolas.fella@gmx.de>
shell_integration/dolphin/ownclouddolphinoverlayplugin.cpp

index 56300f4dfb0527edd3cdb4c56635f232c5e46878..d89aa917404ff7fbcb9e0b7d36950b98d605e65a 100644 (file)
@@ -83,14 +83,16 @@ private:
     void slotCommandRecieved(const QByteArray &line) {
 
         QList<QByteArray> tokens = line.split(':');
-        if (tokens.count() != 3)
+        if (tokens.count() < 3)
             return;
         if (tokens[0] != "STATUS" && tokens[0] != "BROADCAST")
             return;
         if (tokens[2].isEmpty())
             return;
 
-        const QByteArray name = tokens[2];
+        // We can't use tokens[2] because the filename might contain ':'
+        int secondColon = line.indexOf(":", line.indexOf(":") + 1);
+        const QByteArray name = line.mid(secondColon + 1);
         QByteArray &status = m_status[name]; // reference to the item in the hash
         if (status == tokens[1])
             return;