1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-07 02:10:05 +00:00

Check files with same name before post (#638)

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks
2023-11-22 16:57:13 +08:00
committed by GitHub
parent f659a910c9
commit 2d667a5c99
4 changed files with 80 additions and 0 deletions

View File

@@ -584,6 +584,9 @@ upload_api_cb(evhtp_request_t *req, void *arg)
if (error) {
if (error->code == POST_FILE_ERR_FILENAME) {
error_code = ERROR_FILENAME;
} 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");
}
g_clear_error (&error);
}
@@ -1196,6 +1199,9 @@ upload_ajax_cb(evhtp_request_t *req, void *arg)
if (error) {
if (error->code == POST_FILE_ERR_FILENAME) {
error_code = ERROR_FILENAME;
} 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");
}
g_clear_error (&error);
}