Vfs suffix: Require suffix when creating placeholder files
authorChristian Kamm <mail@ckamm.de>
Fri, 29 Mar 2019 08:36:45 +0000 (09:36 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:45 +0000 (10:58 +0100)
src/libsync/vfs/suffix/vfs_suffix.cpp

index aac43ea81ebeececbe9ca67a1159f57740044809..9860c24b2d1c9c859c13f5733ceacce6dbdf25a3 100644 (file)
@@ -63,6 +63,11 @@ void VfsSuffix::createPlaceholder(const SyncFileItem &item)
 {
     // The concrete shape of the placeholder is also used in isDehydratedPlaceholder() below
     QString fn = _setupParams.filesystemPath + item._file;
+    if (!fn.endsWith(fileSuffix())) {
+        ASSERT(false, "vfs file isn't ending with suffix");
+        return;
+    }
+
     QFile file(fn);
     file.open(QFile::ReadWrite | QFile::Truncate);
     file.write(" ");