-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
initial directory listing support #328
Conversation
8e3492f
to
e23be5d
Compare
iroh-gateway/src/handlers.rs
Outdated
let path = match accum.last() { | ||
Some(prev) => { | ||
let base = prev.get("path"); | ||
format!("/{}/{}", base.unwrap_or(&"".to_string()), encode(path_el)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will not do what you want, if base
is empty this will produce //<path_el>
.
match prev.get("path") {
Some(base) => format!("/{}/{}", base, encode(path_el)),
None => format!("/{}", encode(path_el)),
}
should be closer to what you want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually looking at the whole structure this can be simplified to
match accum.last().and_then(|prev| prev.get("path")) {
Some(base) => format!("/{}/{}", base, encode(path_el)),
None => format!("/{}", encode(path_el)),
}
5d7d67a
to
71dc871
Compare
71dc871
to
2a8ba85
Compare
@@ -550,16 +572,59 @@ async fn serve_fs_dir<T: ContentLoader + std::marker::Unpin>( | |||
if !root_path.ends_with('/') { | |||
root_path.push('/'); | |||
} | |||
|
|||
let mut breadcrumbs: Vec<HashMap<&str, String>> = Vec::new(); | |||
root_path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can I get a todo at least for writing a test for this?
2e3bc28
to
586351b
Compare
iroh-util
func, cc @faassen for CLI usage)include_str!
for easier asset maintenancere-interprets the kubo template with iroh colors (I don't think we should be screwing with end-user expectations too much for this first release), but help links point to iroh to avoid bombing kubo maintainers with iroh issues:
punted until later:
closes n0-computer/beetle#258