Skip to content

Commit

Permalink
fix(webserver): changed ldap search from onelevel to subtree (#3909)
Browse files Browse the repository at this point in the history
* fix: changed ldap.rs from onelevel to subtree for better search

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
ifelsefi and autofix-ci[bot] authored Feb 26, 2025
1 parent f31926d commit 1168a98
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion crates/tabby-index-cli/src/commands/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct BenchArgs {
}

pub fn run_bench_cli(index_path: &Path, args: &BenchArgs) -> Result<(), String> {
run_bench(index_path, &args.queries, args.num_repeat).map_err(From::from)
run_bench(index_path, &args.queries, args.num_repeat)
}

fn extract_search_fields(schema: &Schema) -> Vec<Field> {
Expand Down
2 changes: 1 addition & 1 deletion ee/tabby-webserver/src/ldap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl LdapClient for LdapClientImpl {
let searched = client
.search(
&self.base_dn,
Scope::OneLevel,
Scope::Subtree,
&self.user_filter.replace("%s", user),
attrs,
)
Expand Down
33 changes: 16 additions & 17 deletions ee/tabby-webserver/src/service/repository/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ impl RepositoryService for RepositoryServiceImpl {
indices: f.indices,
})
.collect()
})
.map_err(anyhow::Error::from)?;
})?;

Ok(matching)
}
Expand All @@ -249,21 +248,21 @@ impl RepositoryService for RepositoryServiceImpl {
top_n: Option<usize>,
) -> Result<(Vec<FileEntrySearchResult>, bool)> {
let dir = self.resolve_repository(policy, kind, id).await?.dir;
let (files, truncated) = tabby_git::list_files(&dir, rev, top_n)
.await
.map(|list_file| {
let files = list_file
.files
.into_iter()
.map(|f| FileEntrySearchResult {
r#type: f.r#type,
path: f.path,
indices: f.indices,
})
.collect();
(files, list_file.truncated)
})
.map_err(anyhow::Error::from)?;
let (files, truncated) =
tabby_git::list_files(&dir, rev, top_n)
.await
.map(|list_file| {
let files = list_file
.files
.into_iter()
.map(|f| FileEntrySearchResult {
r#type: f.r#type,
path: f.path,
indices: f.indices,
})
.collect();
(files, list_file.truncated)
})?;
Ok((files, truncated))
}

Expand Down

0 comments on commit 1168a98

Please sign in to comment.