diff --git a/daemon/repo-mgr.c b/daemon/repo-mgr.c index 22df93f20..05f329850 100644 --- a/daemon/repo-mgr.c +++ b/daemon/repo-mgr.c @@ -5090,6 +5090,19 @@ handle_dir_added_de (const char *repo_id, ce->ce_mtime.sec = de->mtime; } +static char * +get_repo_name_from_commit (const char *repo_id, int repo_version, const char *commit_id) +{ + SeafCommit *commit = seaf_commit_manager_get_commit (seaf->commit_mgr, + repo_id, + repo_version, + commit_id); + if (!commit) + return NULL; + + return g_strdup(commit->repo_name); +} + #define DEFAULT_DOWNLOAD_THREADS 3 static int @@ -5115,6 +5128,9 @@ download_files_http (const char *repo_id, GList *ptr; FileTxTask *task; int ret = FETCH_CHECKOUT_SUCCESS; + char *repo_name = NULL; + + repo_name = get_repo_name_from_commit (repo_id, repo_version, conflict_head_id); finished_tasks = g_async_queue_new (); @@ -5183,6 +5199,11 @@ download_files_http (const char *repo_id, conflict_hash, no_conflict_hash, conflict_head_id, fset); + // Record a file-level sync error when failed to checkout file. + if (rc == FETCH_CHECKOUT_FAILED) { + send_file_sync_error_notification (repo_id, repo_name, de->name, + SYNC_ERROR_ID_CHECKOUT_FILE); + } if (!http_task->is_clone) { SyncStatus status; if (rc == FETCH_CHECKOUT_FAILED) @@ -5230,6 +5251,7 @@ download_files_http (const char *repo_id, update_index (istate, index_path); out: + g_free (repo_name); /* Wait until all threads exit. * This is necessary when the download is canceled or encountered error. */ diff --git a/daemon/seafile-error.c b/daemon/seafile-error.c index 2a379561d..f333dfcf7 100644 --- a/daemon/seafile-error.c +++ b/daemon/seafile-error.c @@ -184,6 +184,11 @@ static SyncErrorInfo sync_error_info_tbl[] = { SYNC_ERROR_LEVEL_REPO, "Too many files in library" }, + { + SYNC_ERROR_ID_CHECKOUT_FILE, + SYNC_ERROR_LEVEL_FILE, + "Failed to checkout file on the client. Please check disk space or folder permissions" + }, }; const char * diff --git a/include/seafile-error.h b/include/seafile-error.h index 5d35468c7..cb15b42ee 100644 --- a/include/seafile-error.h +++ b/include/seafile-error.h @@ -64,6 +64,7 @@ #define SYNC_ERROR_ID_LIBRARY_TOO_LARGE 32 #define SYNC_ERROR_ID_DEL_CONFIRMATION_PENDING 33 #define SYNC_ERROR_ID_TOO_MANY_FILES 34 -#define N_SYNC_ERROR_ID 35 +#define SYNC_ERROR_ID_CHECKOUT_FILE 35 +#define N_SYNC_ERROR_ID 36 #endif