slashes are not properly %-encoded in path parameters (#304)
This commit is contained in:
parent
a5fea0b061
commit
582e20c397
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2022 Oxide Computer Company
|
// Copyright 2023 Oxide Computer Company
|
||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
@ -366,6 +366,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See https://url.spec.whatwg.org/#url-path-segment-string
|
||||||
const PATH_SET: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS
|
const PATH_SET: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS
|
||||||
.add(b' ')
|
.add(b' ')
|
||||||
.add(b'"')
|
.add(b'"')
|
||||||
|
@ -375,7 +376,9 @@ const PATH_SET: &percent_encoding::AsciiSet = &percent_encoding::CONTROLS
|
||||||
.add(b'?')
|
.add(b'?')
|
||||||
.add(b'`')
|
.add(b'`')
|
||||||
.add(b'{')
|
.add(b'{')
|
||||||
.add(b'}');
|
.add(b'}')
|
||||||
|
.add(b'/')
|
||||||
|
.add(b'%');
|
||||||
|
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
pub fn encode_path(pc: &str) -> String {
|
pub fn encode_path(pc: &str) -> String {
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
// Copyright 2023 Oxide Computer Company
|
||||||
|
|
||||||
|
use progenitor_client::encode_path;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_path_segment_encoding() {
|
||||||
|
assert_eq!(encode_path("192.168.0.0/24"), "192.168.0.0%2F24");
|
||||||
|
}
|
Loading…
Reference in New Issue