diff --git a/common/rpc-service.c b/common/rpc-service.c index bc9c311..bf61640 100644 --- a/common/rpc-service.c +++ b/common/rpc-service.c @@ -4645,11 +4645,21 @@ seafile_list_dir_with_perm (const char *repo_id, return NULL; } + if (!path) { + g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, "Invalid path"); + return NULL; + } + if (!dir_id || !is_object_id_valid (dir_id)) { g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, "Invalid dir id"); return NULL; } + if (!user) { + g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, "Invalid user"); + return NULL; + } + char *rpath = format_dir_path (path); GList *ret = seaf_repo_manager_list_dir_with_perm (seaf->repo_mgr, diff --git a/server/repo-perm.c b/server/repo-perm.c index 72c10b2..83d73ee 100644 --- a/server/repo-perm.c +++ b/server/repo-perm.c @@ -215,11 +215,6 @@ seaf_repo_manager_list_dir_with_perm (SeafRepoManager *mgr, GList *res = NULL; GList *p; - if (!repo_id || !is_uuid_valid(repo_id) || dir_id == NULL || !user) { - g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_DIR_ID, "Bad dir id"); - return NULL; - } - perm = seaf_repo_manager_check_permission (mgr, repo_id, user, error); if (!perm) { if (*error == NULL)