From: Johann150 <
johann@qwertqwefsday.eu>
---
Cargo.lock | 1 +
Cargo.toml | 1 +
src/main.rs | 3 +++
3 files changed, 5 insertions(+)
diff --git a/Cargo.lock b/Cargo.lock
index 677d1e4..6da49e6 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1127,6 +1127,7 @@ dependencies = [
"chrono",
"git2",
"once_cell",
+ "percent-encoding",
"pico-args",
"pulldown-cmark",
"serde",
diff --git a/Cargo.toml b/Cargo.toml
index 49c992f..9515e55 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -15,6 +15,7 @@ async-std = { version = "1.8.0", features = ["attributes"] }
chrono = "0.4"
git2 = {version="0.13", default-features = false}
once_cell = "1.7.2"
+percent-encoding = "2.1"
pico-args = "0.4"
pulldown-cmark = "0.8"
serde = { version = "1.0", features = ["derive"] }
diff --git a/src/main.rs b/src/main.rs
index 6ad1499..9f264ab 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -84,6 +84,9 @@ struct RepoHomeTemplate {
}
fn repo_from_request(repo_name: &str) -> Result<Repository> {
+ let repo_name = percent_encoding::percent_decode_str(repo_name)
+ .decode_utf8_lossy()
+ .into_owned();
let repo_path = Path::new(&CONFIG.repo_directory).join(repo_name);
// TODO CLEAN PATH! VERY IMPORTANT! DONT FORGET!
let r = Repository::open(repo_path)?;
--
2.20.1