1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-16 23:29:25 +00:00

Return error message when query share link info (#698)

* Return rsp content when query share link info

* Add parse error message

---------

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks
2024-09-13 18:33:41 +08:00
committed by GitHub
parent c80bf17efb
commit f27ab0847b
5 changed files with 88 additions and 26 deletions

View File

@@ -1823,11 +1823,22 @@ access_link_cb(evhtp_request_t *req, void *arg)
token = parts[1];
const char *cookie = evhtp_kv_find (req->headers_in, "Cookie");
info = http_tx_manager_query_share_link_info (token, cookie, "file");
int status = HTTP_OK;
char *err_msg = NULL;
info = http_tx_manager_query_share_link_info (token, cookie, "file", &status, &err_msg);
if (!info) {
error_str = "Link token not found\n";
error_code = EVHTP_RES_FORBIDDEN;
goto out;
g_strfreev (parts);
if (status != HTTP_OK) {
evbuffer_add_printf(req->buffer_out, "%s\n", err_msg);
evhtp_send_reply(req, status);
} else {
error_str = "Internal server error\n";
error_code = EVHTP_RES_SERVERR;
evbuffer_add_printf(req->buffer_out, "%s\n", error_str);
evhtp_send_reply(req, error_code);
}
g_free (err_msg);
return;
}
repo_id = seafile_share_link_info_get_repo_id (info);