index : static-web-server.git

ascending towards madness

author Jose Quintana <joseluisquintana20@gmail.com> 2021-02-14 2:10:49.0 +00:00:00
committer Jose Quintana <joseluisquintana20@gmail.com> 2021-02-14 2:10:49.0 +00:00:00
commit
cfcb6cba91ef7ff84f2f5e3fdb8eaad10991cd3d [patch]
tree
d5527f54248444bf11866bb4b7e32fe955fd6730
parent
116cbbfcfe052808b0305a67a77eeb4f411f62c0
download
cfcb6cba91ef7ff84f2f5e3fdb8eaad10991cd3d.tar.gz

refactor: decode url on directory listing



Diff

 src/staticfile_middleware/staticfile.rs | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/staticfile_middleware/staticfile.rs b/src/staticfile_middleware/staticfile.rs
index a44bbf7..4df9ff8 100644
--- a/src/staticfile_middleware/staticfile.rs
+++ b/src/staticfile_middleware/staticfile.rs
@@ -162,6 +162,10 @@ impl Handler for Staticfile {
                );
            }

            let current_path = percent_decode_str(&current_path)
                .decode_utf8()
                .unwrap()
                .to_string();
            let page_str = format!(
                "<html><head><meta charset=\"utf-8\"><title>Index of {}</title></head><body><h1>Index of {}</h1><table style=\"min-width:680px;\"><tr><th colspan=\"3\"><hr></th></tr>{}<tr><th colspan=\"3\"><hr></th></tr></table></body></html>", current_path, current_path, entries_str
            );