diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp index 1dfc685038835..a7d65c30d5399 100644 --- a/src/gui/folderman.cpp +++ b/src/gui/folderman.cpp @@ -1701,9 +1701,29 @@ static QString checkPathValidityRecursive(const QString &path) return FolderMan::tr("The selected path is not a folder!"); } + #ifdef Q_OS_WIN + if (!selFile.isWritable()) { + // isWritable() doesn't cover all NTFS permissions + // Try write + const auto testPath = selFile.dir().filePath("nextcloud-write-test-file.txt"); + const auto fp = fopen(testPath.toStdWString().c_str(), "w"); + if (!fp) { + return FolderMan::tr("You have no permission to write to the selected folder!"); + } + fclose(fp); + + // Try delete + const auto rc = remove(testPath.toStdWString().c_str()); + if (rc) { + return FolderMan::tr("You have no permission to write to the selected folder!"); + } + } + #else if (!selFile.isWritable()) { return FolderMan::tr("You have no permission to write to the selected folder!"); } + #endif + return QString(); }