Skip to content

Commit

Permalink
fix(gateway): populate directory listings
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Jul 2, 2022
1 parent c518ce7 commit c7217f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion iroh-gateway/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Client {
}
}

#[tracing::instrument(skip(rpc_client))]
#[tracing::instrument(skip(self, rpc_client, metrics))]
pub async fn get_file(
&self,
path: iroh_resolver::resolver::Path,
Expand Down
8 changes: 4 additions & 4 deletions iroh-gateway/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl Core {
}
}

#[tracing::instrument()]
#[tracing::instrument(skip(state))]
async fn get_handler(
Extension(state): Extension<Arc<State>>,
Path(params): Path<HashMap<String, String>>,
Expand Down Expand Up @@ -469,9 +469,8 @@ async fn serve_fs_dir(
start_time: std::time::Instant,
) -> Result<GatewayResponse, GatewayError> {
let dir_list = std::str::from_utf8(&dir_list[..]).unwrap();
let mut dir_list_lines = dir_list.lines();
let force_dir = req.query_params.force_dir.unwrap_or(false);
let has_index = dir_list_lines.any(|l| l.starts_with("index.html"));
let has_index = dir_list.lines().any(|l| l.starts_with("index.html"));
if !force_dir && has_index {
if !req.content_path.ends_with('/') {
let redirect_path = format!(
Expand All @@ -496,7 +495,8 @@ async fn serve_fs_dir(
if !root_path.ends_with('/') {
root_path.push('/');
}
let links = dir_list_lines
let links = dir_list
.lines()
.map(|line| {
let mut link = Map::new();
link.insert("name".to_string(), Json::String(get_filename(line)));
Expand Down

0 comments on commit c7217f1

Please sign in to comment.