1
0
mirror of https://github.com/haiwen/seafile-server.git synced 2025-09-04 00:44:21 +00:00

Parse file path from url (#702)

Co-authored-by: 杨赫然 <heran.yang@seafile.com>
This commit is contained in:
feiniks
2024-09-19 16:59:35 +08:00
committed by GitHub
parent 8085a65174
commit 6649fada8c
3 changed files with 6 additions and 7 deletions

View File

@@ -1500,8 +1500,8 @@ access_v2_cb(evhtp_request_t *req, void *arg)
GError *error = NULL;
/* Skip the first '/'. */
char **parts = g_strsplit (req->uri->path->full + 1, "/", 0);
if (!parts || g_strv_length (parts) < 3 ||
char **parts = g_strsplit (req->uri->path->full + 1, "/", 4);
if (!parts || g_strv_length (parts) < 4 ||
strcmp (parts[2], "files") != 0) {
error_str = "Invalid URL\n";
goto out;
@@ -1509,7 +1509,7 @@ access_v2_cb(evhtp_request_t *req, void *arg)
repo_id = parts[1];
path = evhtp_kv_find (req->uri->query, "p");
path = parts[3];
if (!path) {
error_str = "No file path\n";
goto out;