From 04e190ce7e551c7af077e32bca53a45e2cfbcf9c Mon Sep 17 00:00:00 2001 From: feiniks <36756310+feiniks@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:53:58 +0800 Subject: [PATCH] Set site root to / when site root is empty string (#721) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 杨赫然 --- server/seafile-session.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/server/seafile-session.c b/server/seafile-session.c index 04872641..7cc59fb9 100644 --- a/server/seafile-session.c +++ b/server/seafile-session.c @@ -154,18 +154,17 @@ load_config (SeafileSession *session, const char *config_file_path) ret = -1; goto out; } - if (notif_enabled && notif_server != NULL) { + if (notif_enabled && notif_server != NULL) { session->notif_server_private_key = g_strdup (private_key); char notif_url[128]; g_sprintf (notif_url, "%s:%d", notif_server, notif_port); session->notif_url = g_strdup (notif_url); } session->seahub_pk = g_strdup (private_key); - if (site_root) { - session->seahub_url = g_strdup_printf("http://127.0.0.1:8000%sapi/v2.1/internal", site_root); - } else { - session->seahub_url = g_strdup("http://127.0.0.1:8000/api/v2.1/internal"); + if (!site_root || g_strcmp0 (site_root, "") == 0) { + site_root = "/"; } + session->seahub_url = g_strdup_printf("http://127.0.0.1:8000%sapi/v2.1/internal", site_root); session->seahub_conn_pool = connection_pool_new (); if (g_strcmp0 (log_to_stdout, "true") == 0) {