1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-05-12 18:17:28 +00:00

Return 409 when gc conflict

This commit is contained in:
杨赫然 2024-12-23 18:01:54 +08:00
parent db8c637c68
commit d61981f74f
3 changed files with 17 additions and 1 deletions

View File

@ -24,5 +24,6 @@
#define POST_FILE_ERR_QUOTA_FULL 519
#define SEAF_ERR_CONCURRENT_UPLOAD 520
#define SEAF_ERR_FILES_WITH_SAME_NAME 521
#define SEAF_ERR_GC_CONFLICT 522
#endif

View File

@ -579,7 +579,7 @@ retry:
if (check_gc && gc_conflict) {
seaf_warning ("Head branch update for repo %s conflicts with GC.\n",
repo->id);
g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_GENERAL, "GC Conflict");
g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_GC_CONFLICT, "GC Conflict");
ret = -1;
goto out;
}

View File

@ -612,6 +612,9 @@ upload_api_cb(evhtp_request_t *req, void *arg)
} else if (error->code == SEAF_ERR_FILES_WITH_SAME_NAME) {
error_code = -1;
send_error_reply (req, EVHTP_RES_BADREQ, "Too many files with same name.\n");
} else if (error->code == SEAF_ERR_GC_CONFLICT) {
error_code = -1;
send_error_reply (req, EVHTP_RES_CONFLICT, "GC Conflict.\n");
}
g_clear_error (&error);
}
@ -811,6 +814,9 @@ upload_blks_api_cb(evhtp_request_t *req, void *arg)
error_code = ERROR_BLOCK_MISSING;
} else if (error->code == POST_FILE_ERR_QUOTA_FULL) {
error_code = ERROR_QUOTA;
} else if (error->code == SEAF_ERR_GC_CONFLICT) {
error_code = -1;
send_error_reply (req, EVHTP_RES_CONFLICT, "GC Conflict.\n");
}
g_clear_error (&error);
}
@ -1243,6 +1249,9 @@ upload_ajax_cb(evhtp_request_t *req, void *arg)
} else if (error->code == SEAF_ERR_FILES_WITH_SAME_NAME) {
error_code = -1;
send_error_reply (req, EVHTP_RES_BADREQ, "Too many files with same name.\n");
} else if (error->code == SEAF_ERR_GC_CONFLICT) {
error_code = -1;
send_error_reply (req, EVHTP_RES_CONFLICT, "GC Conflict.\n");
}
g_clear_error (&error);
}
@ -1527,6 +1536,9 @@ update_blks_api_cb(evhtp_request_t *req, void *arg)
error_code = ERROR_NOT_EXIST;
} else if (error->code == POST_FILE_ERR_QUOTA_FULL) {
error_code = ERROR_QUOTA;
} else if (error->code == SEAF_ERR_GC_CONFLICT) {
error_code = -1;
send_error_reply (req, EVHTP_RES_CONFLICT, "GC Conflict.\n");
}
g_clear_error (&error);
}
@ -1788,6 +1800,9 @@ update_ajax_cb(evhtp_request_t *req, void *arg)
if (error) {
if (g_strcmp0 (error->message, "file does not exist") == 0) {
error_code = ERROR_NOT_EXIST;
} else if (error->code == SEAF_ERR_GC_CONFLICT) {
error_code = -1;
send_error_reply (req, EVHTP_RES_CONFLICT, "GC Conflict.\n");
}
g_clear_error (&error);
}