πΎ Archived View for lists.flounder.online βΊ patches βΊ threads βΊ 20210315175744.6493-1-johann@qwertqwβ¦ captured on 2022-07-16 at 16:25:44. Gemini links have been rewritten to link to archived content
β¬ οΈ Previous capture (2022-04-28)
-=-=-=-=-=-=-
From: johann@qwertqwefsday.eu
Date: Mon, 15 Mar 2021 18:57:40 +0100
Message-Id: 20210315175744.6493-1-johann@qwertqwefsday.eu
To: <~aw/patches@lists.sr.ht>
Cc: "Johann150" <johann@qwertqwefsday.eu>
--------------------------------------
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
From: alex@alexwennerberg.com
Date: Mon, 15 Mar 2021 12:01:44 -0700
Message-Id: C9Y5O3EFDVMX.38PU2L9KTC47S@debian-alex
To: "Johann Galle" <johann@qwertqwefsday.eu>, <~aw/patches@lists.sr.ht>
In-Reply-To: 20210315175744.6493-1-johann@qwertqwefsday.eu
--------------------------------------
Hi these look good! I'm on lunch break so I don't have time to look into
this in detail -- but my only question is about the first patch -- the
other 4 are ready to apply. Is there a way to do this that uses the tide
crate itself rather than another crate? I havent checked but it seems
like something I would expect the crate to be able to do
Alex
On Mon Mar 15, 2021 at 10:57 AM PDT, Johann Galle wrote:
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
From: johann@qwertqwefsday.eu
Date: Mon, 15 Mar 2021 21:54:32 +0100
Message-Id: 5d3834d5-8da1-c5d6-a7dc-a5ee16820eaf@qwertqwefsday.eu
To: "Alex Wennerberg" <alex@alexwennerberg.com>, <~aw/patches@lists.sr.ht>
In-Reply-To: C9Y5O3EFDVMX.38PU2L9KTC47S@debian-alex
--------------------------------------
On 2021-03-15T20:01+01:00, Alex Wennerberg wrote:
Hi these look good! I'm on lunch break so I don't have time to look into this in detail -- but my only question is about the first patch -- the other 4 are ready to apply. Is there a way to do this that uses the tide crate itself rather than another crate? I havent checked but it seems like something I would expect the crate to be able to do
That is something I also wondered and tried to find on <https://docs.rs/tide>. Searching for "percent", "url", "encode" or "decode" did not bring anything up. Same results for the re-exportet http-types crate. But anyway we were already indirectly dependent on the percent-encoding crate [1], so the meaning of adding this to our Crates.toml only means that we can now also access it.
[1] more completely, we get this inverse dependency tree for it:
$ cargo tree -i percent-encoding
percent-encoding v2.1.0
βββ askama_shared v0.11.1
βΒ Β βββ askama v0.10.5
βΒ Β βΒ Β βββ askama_tide v0.13.0
βΒ Β βΒ Β βΒ Β βββ grifter v0.1.0
βΒ Β βΒ Β βββ grifter v0.1.0
βΒ Β βββ askama_derive v0.10.5 (proc-macro)
βΒ Β Β Β Β Β βββ askama v0.10.5 (*)
βββ cookie v0.14.4
βΒ Β βββ http-types v2.10.0
βΒ Β Β Β Β Β βββ async-h1 v2.3.2
βΒ Β Β Β Β Β βΒ Β βββ tide v0.16.0
βΒ Β Β Β Β Β βΒ Β Β Β Β Β βββ askama_tide v0.13.0 (*)
βΒ Β Β Β Β Β βΒ Β Β Β Β Β βββ grifter v0.1.0
βΒ Β Β Β Β Β βββ async-sse v4.1.0
βΒ Β Β Β Β Β βΒ Β βββ tide v0.16.0 (*)
βΒ Β Β Β Β Β βββ http-client v6.3.4
βΒ Β Β Β Β Β βΒ Β βββ tide v0.16.0 (*)
βΒ Β Β Β Β Β βββ tide v0.16.0 (*)
βββ form_urlencoded v1.0.1
βΒ Β βββ serde_urlencoded v0.7.0
βΒ Β βΒ Β βββ http-types v2.10.0 (*)
βΒ Β βββ url v2.2.1
βΒ Β Β Β Β Β βββ git2 v0.13.17
βΒ Β Β Β Β Β βΒ Β βββ grifter v0.1.0
βΒ Β Β Β Β Β βββ http-types v2.10.00 (*)
βββ grifter v0.1.0
βββ serde_qs v0.7.2
βΒ Β βββ http-types v2.10.0 (*)
βββ url v2.2.1 (*)
From: alex@alexwennerberg.com
Date: Mon, 15 Mar 2021 16:22:39 -0700
Message-Id: A43A6913-A1B7-4B7A-959D-E9CEBA269AF2@alexwennerberg.com
To: "Johann Galle" <johann@qwertqwefsday.eu>
In-Reply-To: 5d3834d5-8da1-c5d6-a7dc-a5ee16820eaf@qwertqwefsday.eu
Cc: <~aw/patches@lists.sr.ht>
--------------------------------------
Makes sense to me. Iβll merge these as soon as I get home
Alex
On Mar 15, 2021, at 1:54 PM, Johann Galle <johann@qwertqwefsday.eu> wrote:
ο»ΏOn 2021-03-15T20:01+01:00, Alex Wennerberg wrote:
> Hi these look good! I'm on lunch break so I don't have time to look into this in detail -- but my only question is about the first patch -- the other 4 are ready to apply. Is there a way to do this that uses the tide crate itself rather than another crate? I havent checked but it seems like something I would expect the crate to be able to do
That is something I also wondered and tried to find on <https://docs.rs/tide>. Searching for "percent", "url", "encode" or "decode" did not bring anything up. Same results for the re-exportet http-types crate. But anyway we were already indirectly dependent on the percent-encoding crate [1], so the meaning of adding this to our Crates.toml only means that we can now also access it.
[1] more completely, we get this inverse dependency tree for it:
$ cargo tree -i percent-encoding
percent-encoding v2.1.0
βββ askama_shared v0.11.1
β βββ askama v0.10.5
β β βββ askama_tide v0.13.0
β β β βββ grifter v0.1.0
β β βββ grifter v0.1.0
β βββ askama_derive v0.10.5 (proc-macro)
β βββ askama v0.10.5 (*)
βββ cookie v0.14.4
β βββ http-types v2.10.0
β βββ async-h1 v2.3.2
β β βββ tide v0.16.0
β β βββ askama_tide v0.13.0 (*)
β β βββ grifter v0.1.0
β βββ async-sse v4.1.0
β β βββ tide v0.16.0 (*)
β βββ http-client v6.3.4
β β βββ tide v0.16.0 (*)
β βββ tide v0.16.0 (*)
βββ form_urlencoded v1.0.1
β βββ serde_urlencoded v0.7.0
β β βββ http-types v2.10.0 (*)
β βββ url v2.2.1
β βββ git2 v0.13.17
β β βββ grifter v0.1.0
β βββ http-types v2.10.00 (*)
βββ grifter v0.1.0
βββ serde_qs v0.7.2
β βββ http-types v2.10.0 (*)
βββ url v2.2.1 (*)