Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: The mounted Samba network disk prompts that the file has been moved or deleted after the user changes their password #84

Merged
merged 1 commit into from
Jul 11, 2024
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
3 changes: 3 additions & 0 deletions include/dfm-io/dfm-io/error/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ enum DFMIOErrorCode {
DFM_IO_ERROR_OPEN_FLAG_ERROR, // File open flag is error
DFM_IO_ERROR_INFO_NO_ATTRIBUTE, // File info has no attribute
DFM_IO_ERROR_FTS_OPEN, // open file by fts failed
DFM_IO_ERROR_HOST_IS_DOWN, // remote server maybe down
};

inline const QString GetError_En(DFMIOErrorCode errorCode)
Expand Down Expand Up @@ -179,6 +180,8 @@ inline const QString GetError_En(DFMIOErrorCode errorCode)
return QObject::tr("open file by fts failed");
case DFM_IO_ERROR_USER_FAILED:
return QString();
case DFM_IO_ERROR_HOST_IS_DOWN:
return QObject::tr("Host is down");
}

return QString("Unknown error");
Expand Down
8 changes: 8 additions & 0 deletions src/dfm-io/dfm-io/dfileinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ void DFileInfoPrivate::setErrorFromGError(GError *gerror)
{
if (!gerror)
return;

if (g_error_matches(gerror, G_IO_ERROR,G_IO_ERROR_FAILED) &&
QString(gerror->message).contains(strerror(EHOSTDOWN))) {
error.setCode(DFMIOErrorCode::DFM_IO_ERROR_HOST_IS_DOWN);
error.setMessage(gerror->message);
return;
}

error.setCode(DFMIOErrorCode(gerror->code));
if (error.code() == DFMIOErrorCode::DFM_IO_ERROR_FAILED)
error.setMessage(gerror->message);
Expand Down
Loading