Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix network drive detection #8649

Merged
merged 1 commit into from
May 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/8272
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Correctly detect network drives

We fixed a bug which allowed to use Virtual files on Windows network drives, which is not supported by Windows.

https://github.com/owncloud/client/issues/8272
9 changes: 7 additions & 2 deletions src/common/vfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,18 @@ Result<bool, QString> Vfs::checkAvailability(const QString &path)
const auto mode = bestAvailableVfsMode();
#ifdef Q_OS_WIN
if (mode == Mode::WindowsCfApi) {
if (QDir(QDir(path).canonicalPath()).isRoot()) {
const auto info = QFileInfo(path);
if (QDir(info.canonicalPath()).isRoot()) {
return tr("The Virtual filesystem feature does not support a drive as sync root");
}
const auto fs = FileSystem::fileSystemForPath(path);
const auto fs = FileSystem::fileSystemForPath(info.absoluteFilePath());
if (fs != QLatin1String("NTFS")) {
return tr("The Virtual filesystem feature requires a NTFS file system, %1 is using %2").arg(path, fs);
}
const auto type = GetDriveTypeW(reinterpret_cast<const wchar_t *>(QDir::toNativeSeparators(info.absoluteFilePath().mid(0, 3)).utf16()));
if (type == DRIVE_REMOTE) {
return tr("The Virtual filesystem feature is not supported on network drives");
}
}
#else
Q_UNUSED(path);
Expand Down