mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-08-01 23:33:42 +00:00
Return 409 when gc conflict
This commit is contained in:
parent
db8c637c68
commit
d61981f74f
@ -24,5 +24,6 @@
|
|||||||
#define POST_FILE_ERR_QUOTA_FULL 519
|
#define POST_FILE_ERR_QUOTA_FULL 519
|
||||||
#define SEAF_ERR_CONCURRENT_UPLOAD 520
|
#define SEAF_ERR_CONCURRENT_UPLOAD 520
|
||||||
#define SEAF_ERR_FILES_WITH_SAME_NAME 521
|
#define SEAF_ERR_FILES_WITH_SAME_NAME 521
|
||||||
|
#define SEAF_ERR_GC_CONFLICT 522
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -579,7 +579,7 @@ retry:
|
|||||||
if (check_gc && gc_conflict) {
|
if (check_gc && gc_conflict) {
|
||||||
seaf_warning ("Head branch update for repo %s conflicts with GC.\n",
|
seaf_warning ("Head branch update for repo %s conflicts with GC.\n",
|
||||||
repo->id);
|
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;
|
ret = -1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
@ -612,6 +612,9 @@ upload_api_cb(evhtp_request_t *req, void *arg)
|
|||||||
} else if (error->code == SEAF_ERR_FILES_WITH_SAME_NAME) {
|
} else if (error->code == SEAF_ERR_FILES_WITH_SAME_NAME) {
|
||||||
error_code = -1;
|
error_code = -1;
|
||||||
send_error_reply (req, EVHTP_RES_BADREQ, "Too many files with same name.\n");
|
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);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
@ -811,6 +814,9 @@ upload_blks_api_cb(evhtp_request_t *req, void *arg)
|
|||||||
error_code = ERROR_BLOCK_MISSING;
|
error_code = ERROR_BLOCK_MISSING;
|
||||||
} else if (error->code == POST_FILE_ERR_QUOTA_FULL) {
|
} else if (error->code == POST_FILE_ERR_QUOTA_FULL) {
|
||||||
error_code = ERROR_QUOTA;
|
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);
|
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) {
|
} else if (error->code == SEAF_ERR_FILES_WITH_SAME_NAME) {
|
||||||
error_code = -1;
|
error_code = -1;
|
||||||
send_error_reply (req, EVHTP_RES_BADREQ, "Too many files with same name.\n");
|
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);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
@ -1527,6 +1536,9 @@ update_blks_api_cb(evhtp_request_t *req, void *arg)
|
|||||||
error_code = ERROR_NOT_EXIST;
|
error_code = ERROR_NOT_EXIST;
|
||||||
} else if (error->code == POST_FILE_ERR_QUOTA_FULL) {
|
} else if (error->code == POST_FILE_ERR_QUOTA_FULL) {
|
||||||
error_code = ERROR_QUOTA;
|
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);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
@ -1788,6 +1800,9 @@ update_ajax_cb(evhtp_request_t *req, void *arg)
|
|||||||
if (error) {
|
if (error) {
|
||||||
if (g_strcmp0 (error->message, "file does not exist") == 0) {
|
if (g_strcmp0 (error->message, "file does not exist") == 0) {
|
||||||
error_code = ERROR_NOT_EXIST;
|
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);
|
g_clear_error (&error);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user