diff --git a/src/plugins/common/dfmplugin-dirshare/dirshare.cpp b/src/plugins/common/dfmplugin-dirshare/dirshare.cpp index bac6b51504..28f46d1d28 100644 --- a/src/plugins/common/dfmplugin-dirshare/dirshare.cpp +++ b/src/plugins/common/dfmplugin-dirshare/dirshare.cpp @@ -49,7 +49,17 @@ QWidget *DirShare::createShareControlWidget(const QUrl &url) if (!supported.contains(url.scheme())) return nullptr; - auto info = InfoFactory::create(url); + QFileInfo fileInfo(url.toLocalFile()); + if (!fileInfo.exists()) + return nullptr; + + QString canonicalPath = fileInfo.canonicalFilePath(); + if (canonicalPath.isEmpty()) + return nullptr; + + QUrl canonicalUrl = QUrl::fromLocalFile(canonicalPath); + auto info = InfoFactory::create(canonicalUrl); + bool disableWidget = UserShareHelper::needDisableShareWidget(info); if (!UserShareHelper::canShare(info)) return nullptr;