mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-22 13:05:51 +03:00
Merge pull request #7068 from nextcloud/bugfix/ensureReliableFileFolderDetection
ensure detection of entry type on windows is reliable
This commit is contained in:
commit
e12667f699
1 changed files with 6 additions and 5 deletions
|
@ -142,9 +142,11 @@ std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *h
|
|||
file_stat = std::make_unique<csync_file_stat_t>();
|
||||
file_stat->path = path.toUtf8();
|
||||
|
||||
const auto isDirectory = handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
|
||||
|
||||
if (vfs && vfs->statTypeVirtualFile(file_stat.get(), &handle->ffd)) {
|
||||
// all good
|
||||
} else if (handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) {
|
||||
} else if ((handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && !isDirectory) {
|
||||
// Detect symlinks, and treat junctions as symlinks too.
|
||||
if (handle->ffd.dwReserved0 == IO_REPARSE_TAG_SYMLINK
|
||||
|| handle->ffd.dwReserved0 == IO_REPARSE_TAG_MOUNT_POINT) {
|
||||
|
@ -155,11 +157,10 @@ std::unique_ptr<csync_file_stat_t> csync_vio_local_readdir(csync_vio_handle_t *h
|
|||
// but will also treat them normally for now.
|
||||
file_stat->type = ItemTypeFile;
|
||||
}
|
||||
} else if (handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_DEVICE
|
||||
|| handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE
|
||||
) {
|
||||
} else if ((handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_DEVICE || handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_OFFLINE) &&
|
||||
!isDirectory) {
|
||||
file_stat->type = ItemTypeSkip;
|
||||
} else if (handle->ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
} else if (isDirectory) {
|
||||
file_stat->type = ItemTypeDirectory;
|
||||
} else {
|
||||
file_stat->type = ItemTypeFile;
|
||||
|
|
Loading…
Reference in a new issue