diff --git a/sftp/kio_sftp.cpp b/sftp/kio_sftp.cpp --- a/sftp/kio_sftp.cpp +++ b/sftp/kio_sftp.cpp @@ -1387,7 +1387,7 @@ } if (mOpenFile == nullptr) { - return Result::fail(KIO::ERR_CANNOT_OPEN_FOR_READING, path); + return Result::fail(toKIOError(sftp_get_error(mSftp)), path); } // Determine the mimetype of the file to be retrieved, and emit it.