Commit 546a4d2d authored by Fabian Vogt's avatar Fabian Vogt

Merge branch 'refixRemoteUrl' into 'master'

Fix generation of Remote URL

See merge request kde/kio-fuse!19
parents d2d028a8 4a3aa277
......@@ -1360,13 +1360,25 @@ fuse_ino_t KIOFuseVFS::insertNode(const std::shared_ptr<KIOFuseNode> &node, fuse
return ino;
}
QUrl KIOFuseVFS::sanitizeNullAuthority(QUrl url) const
{
// Workaround to allow url with scheme "file"
// to have a path that starts with "//"
// Without this patch...
// file: + //tmp = invalid URL
// file:// + //tmp = file////tmp
if(url.authority().isNull())
url.setAuthority(QStringLiteral(""));
return url;
}
QUrl KIOFuseVFS::remoteUrl(const std::shared_ptr<const KIOFuseNode> &node) const
{
// Special handling for KIOFuseRemoteFileNode
if(auto remoteFileNode = std::dynamic_pointer_cast<const KIOFuseRemoteFileNode>(node))
{
if(!remoteFileNode->m_overrideUrl.isEmpty())
return remoteFileNode->m_overrideUrl;
return sanitizeNullAuthority(remoteFileNode->m_overrideUrl);
}
QStringList path;
......@@ -1376,7 +1388,7 @@ QUrl KIOFuseVFS::remoteUrl(const std::shared_ptr<const KIOFuseNode> &node) const
if(remoteDirNode && !remoteDirNode->m_overrideUrl.isEmpty())
{
// Origin found - add path and return
QUrl url = remoteDirNode->m_overrideUrl;
QUrl url = sanitizeNullAuthority(remoteDirNode->m_overrideUrl);
url.setPath(url.path() + path.join(QLatin1Char('/')), QUrl::DecodedMode);
return url;
}
......
......@@ -155,6 +155,8 @@ private:
/** Returns the override URL for an origin node */
QUrl makeOriginUrl(QUrl url);
/** If authority of URL is null, adds an empty authority instead */
QUrl sanitizeNullAuthority(QUrl url) const;
/** Returns the corresponding FUSE error to the given KIO Job error */
static int kioErrorToFuseError(const int kioError);
......
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