Skip to content
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
2 changes: 1 addition & 1 deletion src/dfm-io/dfm-io/dfmio_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ bool DFMUtils::isGvfsFile(const QUrl &url)
return false;

const QString &path = url.toLocalFile();
static const QString *gvfsMatch = new QString{ "(^/run/user/\\d+/gvfs/|^/root/.gvfs/|^/media/[\\s\\S]*/smbmounts)" };
static const QString *gvfsMatch = new QString{ "(^/run/user/\\d+/gvfs/|^/root/.gvfs/|^/(?:run/)?media/[\\s\\S]*/smbmounts)" };
// TODO(xust) /media/$USER/smbmounts might be changed in the future.
QRegularExpression re { *gvfsMatch };
QRegularExpressionMatch match { re.match(path) };
Expand Down
7 changes: 5 additions & 2 deletions src/dfm-io/dfm-io/utils/dlocalhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1284,14 +1284,17 @@ QString DLocalHelper::resolveSymlink(const QUrl &url)
{
QSet<QString> visited;
QString target = DLocalHelper::symlinkTarget(url);
if (DFMUtils::isGvfsFile(QUrl::fromLocalFile(target)))
return target; // Remote target: stop resolving, further readlink/stat would block on network I/O
Comment on lines +1287 to +1288

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Remote directory links appear as files

When a symlink resolves to a directory under a GVFS path, createSortFileInfo skips stat() for the returned target and leaves isDir false, so insertSortFileInfoList treats the directory symlink as a file and directory-first ordering and filters misclassify it.

Set the directory/file classification for GVFS targets before returning them from either target check.

Also at src/dfm-io/dfm-io/utils/dlocalhelper.cpp:1297-1298.

Prompt for AI agents
In `src/dfm-io/dfm-io/utils/dlocalhelper.cpp` at lines 1287-1288:

**Remote directory links appear as files**

When a symlink resolves to a directory under a GVFS path, `createSortFileInfo` skips `stat()` for the returned target and leaves `isDir` false, so `insertSortFileInfoList` treats the directory symlink as a file and directory-first ordering and filters misclassify it.

Set the directory/file classification for GVFS targets before returning them from either target check.

Also at `src/dfm-io/dfm-io/utils/dlocalhelper.cpp:1297-1298`.

while (!target.isEmpty()) {
if (visited.contains(target))
return QString(); // Cycle detected: return empty
visited.insert(target);
QUrl newUrl = QUrl::fromLocalFile(target);
QString nextTarget = DLocalHelper::symlinkTarget(newUrl);
QString nextTarget = DLocalHelper::symlinkTarget(QUrl::fromLocalFile(target));
if (nextTarget.isEmpty())
break;
if (DFMUtils::isGvfsFile(QUrl::fromLocalFile(nextTarget)))
return nextTarget; // Remote target: stop resolving, further readlink/stat would block on network I/O
target = nextTarget;
}
return target;
Expand Down
Loading