diff --git a/daemon/http-tx-mgr.c b/daemon/http-tx-mgr.c index 9ef83a7c9..4bd8d1db1 100644 --- a/daemon/http-tx-mgr.c +++ b/daemon/http-tx-mgr.c @@ -45,6 +45,7 @@ #define HTTP_REPO_DELETED 444 #define HTTP_REPO_TOO_LARGE 447 #define HTTP_REPO_CORRUPTED 445 +#define HTTP_BLOCK_MISSING 446 #define HTTP_INTERNAL_SERVER_ERROR 500 #define RESET_BYTES_INTERVAL_MSEC 1000 @@ -3817,11 +3818,16 @@ update_branch (HttpTxTask *task, Connection *conn) seaf_warning ("Bad response code for PUT %s: %d.\n", url, status); handle_http_errors (task, status); - if (status == HTTP_FORBIDDEN) { + if (status == HTTP_FORBIDDEN || status == HTTP_BLOCK_MISSING) { rsp_content_str = g_new0 (gchar, rsp_size + 1); memcpy (rsp_content_str, rsp_content, rsp_size); - seaf_warning ("%s\n", rsp_content_str); - notify_permission_error (task, rsp_content_str); + if (status == HTTP_FORBIDDEN) { + seaf_warning ("%s\n", rsp_content_str); + notify_permission_error (task, rsp_content_str); + } else if (status == HTTP_BLOCK_MISSING) { + seaf_warning ("Failed to upload files: %s\n", rsp_content_str); + task->error = SYNC_ERROR_ID_BLOCK_MISSING; + } g_free (rsp_content_str); } diff --git a/daemon/seafile-error.c b/daemon/seafile-error.c index f333dfcf7..6b7a1d345 100644 --- a/daemon/seafile-error.c +++ b/daemon/seafile-error.c @@ -189,6 +189,11 @@ static SyncErrorInfo sync_error_info_tbl[] = { SYNC_ERROR_LEVEL_FILE, "Failed to checkout file on the client. Please check disk space or folder permissions" }, + { + SYNC_ERROR_ID_BLOCK_MISSING, + SYNC_ERROR_LEVEL_REPO, + "Failed to upload file blocks. Please check network or firewall" + }, }; const char * diff --git a/include/seafile-error.h b/include/seafile-error.h index cb15b42ee..280ea23eb 100644 --- a/include/seafile-error.h +++ b/include/seafile-error.h @@ -65,6 +65,7 @@ #define SYNC_ERROR_ID_DEL_CONFIRMATION_PENDING 33 #define SYNC_ERROR_ID_TOO_MANY_FILES 34 #define SYNC_ERROR_ID_CHECKOUT_FILE 35 -#define N_SYNC_ERROR_ID 36 +#define SYNC_ERROR_ID_BLOCK_MISSING 36 +#define N_SYNC_ERROR_ID 37 #endif