Skip to content

Commit

Permalink
fix: [io]After sending a folder to the desktop with smb service mount…
Browse files Browse the repository at this point in the history
…ed, the link target file cannot be found when previewing it with space.

After reboot, it is not mounted, and when it is mounted again, the desktop does not listen to the protocol device, so it doesn't update the fileinfo. so there is something wrong with the attribute.

Log: After sending a folder to the desktop with smb service mounted, the link target file cannot be found when previewing it with space.
Bug: https://pms.uniontech.com/bug-view-219383.html
  • Loading branch information
liyigang1 authored and max-lvs committed Sep 22, 2023
1 parent 010fc5c commit a179844
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/dfm-base/file/local/asyncfileinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,11 @@ QIcon AsyncFileInfoPrivate::defaultIcon()
const auto &&target = q->pathOf(PathInfoType::kSymLinkTarget);
if (!target.isEmpty() && target != q->pathOf(PathInfoType::kFilePath)) {
FileInfoPointer info = InfoFactory::create<FileInfo>(QUrl::fromLocalFile(target));
if (info)
if (info) {
if (info->fileIcon().name() == "unknown")
info->customData(Global::ItemRoles::kItemFileRefreshIcon);
icon = info->fileIcon();
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,17 @@ void PreviewDialogManager::showPreviewDialog(const quint64 winId, const QList<QU
continue;
}

const FileInfoPointer linkInfo = InfoFactory::create<FileInfo>(targetUrl);
if (!linkInfo || !linkInfo->exists()) {
dfmio::DFile file(targetUrl);
if (!file.exists()) {
hasInvalidSymlink = true;
continue;
}

const FileInfoPointer linkInfo = InfoFactory::create<FileInfo>(targetUrl);
if (linkInfo && !linkInfo->exists() && linkInfo->timeOf(TimeInfoType::kCreateTimeSecond) == 0) {
info->refresh();
linkInfo->refresh();
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ void FileInfoModelPrivate::resetData(const QList<QUrl> &urls)
QMap<QUrl, FileInfoPointer> fileMaps;
for (const QUrl &child : urls) {
if (auto itemInfo = FileCreator->createFileInfo(child)) {
if (itemInfo->isAttributes(OptInfoType::kIsSymLink) &&
!FileUtils::isLocalDevice(QUrl::fromLocalFile(itemInfo->pathOf(PathInfoType::kSymLinkTarget))))
itemInfo->refresh();
fileUrls.append(itemInfo->urlOf(UrlInfoType::kUrl));
fileMaps.insert(itemInfo->urlOf(UrlInfoType::kUrl), itemInfo);
}
Expand Down

0 comments on commit a179844

Please sign in to comment.