Commit 5dab2a0d authored by Jonathan Marten's avatar Jonathan Marten
Browse files

nfs (v3): Return entries for "." in listDir()

Eliminates the runtime message:
kio_nfs KIO::SlaveBase::finished: UDSEntry for '.' not found, creating a default one.
Please fix the "kio_nfs" KIO slave
parent 2455972f
......@@ -519,7 +519,8 @@ const QStringList& NFSProtocol::getExportedDirs()
bool NFSProtocol::isExportedDir(const QString& path)
{
// If the path is the root filesystem we always return true.
if (QFileInfo(path).isRoot()) {
if (path.isEmpty() || path == "/" || QFileInfo(path).isRoot()) {
qCDebug(LOG_KIO_NFS) << path << "is root";
return true;
}
......@@ -527,8 +528,7 @@ bool NFSProtocol::isExportedDir(const QString& path)
if (path.length() < (*it).length() && (*it).startsWith(path)) {
QString rest = (*it).mid(path.length());
if (rest.isEmpty() || rest[0] == QDir::separator()) {
qCDebug(LOG_KIO_NFS) << "isExportedDir" << path << "returning true";
qCDebug(LOG_KIO_NFS) << path << "is exported";
return true;
}
}
......
......@@ -330,12 +330,15 @@ void NFSProtocolV3::listDir(const QUrl& url)
}
}
KIO::UDSEntry entry;
createVirtualDirEntry(entry);
entry.insert(KIO::UDSEntry::UDS_NAME, ".");
m_slave->listEntry(entry);
for (QStringList::const_iterator it = virtualList.constBegin(); it != virtualList.constEnd(); ++it) {
qCDebug(LOG_KIO_NFS) << "Found " << (*it) << "in exported dir";
KIO::UDSEntry entry;
entry.insert(KIO::UDSEntry::UDS_NAME, (*it));
createVirtualDirEntry(entry);
m_slave->listEntry(entry);
}
......@@ -392,15 +395,22 @@ void NFSProtocolV3::listDir(const QUrl& url)
}
for (entryplus3* dirEntry = listres.READDIRPLUS3res_u.resok.reply.entries; dirEntry != nullptr; dirEntry = dirEntry->nextentry) {
if (dirEntry->name == QString(".") || dirEntry->name == QString("..")) {
if (dirEntry->name == QString("..")) {
continue;
}
const QString& filePath = QFileInfo(QDir(path), dirEntry->name).filePath();
KIO::UDSEntry entry;
entry.insert(KIO::UDSEntry::UDS_NAME, dirEntry->name);
if (dirEntry->name == QString(".")) {
createVirtualDirEntry(entry);
completeUDSEntry(entry, dirEntry->name_attributes.post_op_attr_u.attributes);
m_slave->listEntry(entry);
continue;
}
const QString& filePath = QFileInfo(QDir(path), dirEntry->name).filePath();
// Is it a symlink ?
if (dirEntry->name_attributes.post_op_attr_u.attributes.type == NF3LNK) {
int rpcStatus;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment