diff --git a/smb/CMakeLists.txt b/smb/CMakeLists.txt --- a/smb/CMakeLists.txt +++ b/smb/CMakeLists.txt @@ -10,6 +10,10 @@ check_include_file(utime.h HAVE_UTIME_H) configure_file(config-smb.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-smb.h) +foreach(PROTOCOL smb cifs) + configure_file(smb.protocol.cmake ${CMAKE_CURRENT_BINARY_DIR}/${PROTOCOL}.protocol) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROTOCOL}.protocol DESTINATION ${KDE_INSTALL_KSERVICES5DIR}) +endforeach() set(kio_smb_PART_SRCS kio_smb.cpp @@ -53,6 +57,5 @@ ########### install files ############### install( FILES smb-network.desktop DESTINATION ${KDE_INSTALL_DATADIR}/konqueror/dirtree/remote ) -install( FILES smb.protocol DESTINATION ${KDE_INSTALL_KSERVICES5DIR} ) install( FILES smb-network.desktop DESTINATION ${KDE_INSTALL_DATADIR}/remoteview ) diff --git a/smb/kio_smb_browse.cpp b/smb/kio_smb_browse.cpp --- a/smb/kio_smb_browse.cpp +++ b/smb/kio_smb_browse.cpp @@ -183,10 +183,24 @@ } //=========================================================================== -// TODO: complete checking -QUrl SMBSlave::checkURL(const QUrl& kurl) const +// TODO: complete checking <-- what does that even mean? +// TODO: why is this not part of SMBUrl or at the very least URL validation should +// be 100% shared between this and SMBUrl. Notably SMBUrl has code that looks +// to do a similar thing but is much less complete. +QUrl SMBSlave::checkURL(const QUrl &kurl_) const { - qCDebug(KIO_SMB) << "checkURL " << kurl; + qCDebug(KIO_SMB) << "checkURL " << kurl_; + + QUrl kurl(kurl_); + // We treat cifs as an alias but need to translate it to smb. + // https://bugs.kde.org/show_bug.cgi?id=327295 + // It's not IANA registered and also libsmbc internally expects + // smb URIs so we do very broadly coerce cifs to smb. + // Also see SMBUrl. + if (kurl.scheme() == "cifs") { + kurl.setScheme("smb"); + } + QString surl = kurl.url(); //transform any links in the form smb:/ into smb:// if (surl.startsWith(QLatin1String("smb:/"))) { diff --git a/smb/kio_smb_internal.cpp b/smb/kio_smb_internal.cpp --- a/smb/kio_smb_internal.cpp +++ b/smb/kio_smb_internal.cpp @@ -51,6 +51,14 @@ : QUrl(kurl) //----------------------------------------------------------------------- { + // We treat cifs as an alias but need to translate it to smb. + // https://bugs.kde.org/show_bug.cgi?id=327295 + // It's not IANA registered and also libsmbc internally expects + // smb URIs so we do very broadly coerce cifs to smb. + // Also see SMBSlave::checkURL. + if (scheme() == "cifs") { + setScheme("smb"); + } updateCache(); } diff --git a/smb/smb.protocol b/smb/smb.protocol.cmake rename from smb/smb.protocol rename to smb/smb.protocol.cmake --- a/smb/smb.protocol +++ b/smb/smb.protocol.cmake @@ -1,6 +1,6 @@ [Protocol] exec=kf5/kio/smb -protocol=smb +protocol=@PROTOCOL@ input=none output=filesystem listing=Name,Type,Size,Date,Access,Owner,Group