mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-09-25 14:42:52 +00:00
Merge pull request #189 from haiwen/fix_list_dir_with_perm
Fix the invalid arguments process of list_dir_with_perm.
This commit is contained in:
@@ -4645,11 +4645,21 @@ seafile_list_dir_with_perm (const char *repo_id,
|
|||||||
return NULL;
|
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)) {
|
if (!dir_id || !is_object_id_valid (dir_id)) {
|
||||||
g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, "Invalid dir id");
|
g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, "Invalid dir id");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
g_set_error (error, SEAFILE_DOMAIN, SEAF_ERR_BAD_ARGS, "Invalid user");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
char *rpath = format_dir_path (path);
|
char *rpath = format_dir_path (path);
|
||||||
|
|
||||||
GList *ret = seaf_repo_manager_list_dir_with_perm (seaf->repo_mgr,
|
GList *ret = seaf_repo_manager_list_dir_with_perm (seaf->repo_mgr,
|
||||||
|
@@ -215,11 +215,6 @@ seaf_repo_manager_list_dir_with_perm (SeafRepoManager *mgr,
|
|||||||
GList *res = NULL;
|
GList *res = NULL;
|
||||||
GList *p;
|
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);
|
perm = seaf_repo_manager_check_permission (mgr, repo_id, user, error);
|
||||||
if (!perm) {
|
if (!perm) {
|
||||||
if (*error == NULL)
|
if (*error == NULL)
|
||||||
|
Reference in New Issue
Block a user