mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 21:41:03 +00:00
aws: s3: Properly percent-decode GstS3Url
We previously only percent-decoded the first fragment. This doesn't necessarily harm anything, but for consistency we keep the structure un-encoded, and encode when converting to a string representation. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1333>
This commit is contained in:
parent
51129febeb
commit
bb26e04a55
1 changed files with 11 additions and 5 deletions
|
@ -83,15 +83,21 @@ pub fn parse_s3_url(url_str: &str) -> Result<GstS3Url, String> {
|
||||||
.next()
|
.next()
|
||||||
.ok_or_else(|| format!("Invalid empty object/bucket '{url}'"))?;
|
.ok_or_else(|| format!("Invalid empty object/bucket '{url}'"))?;
|
||||||
|
|
||||||
let mut object = percent_decode(o.as_bytes())
|
|
||||||
.decode_utf8()
|
|
||||||
.unwrap()
|
|
||||||
.to_string();
|
|
||||||
if o.is_empty() {
|
if o.is_empty() {
|
||||||
return Err(format!("Invalid empty object/bucket '{url}'"));
|
return Err(format!("Invalid empty object/bucket '{url}'"));
|
||||||
}
|
}
|
||||||
|
|
||||||
object = path.fold(object, |o, p| format!("{o}/{p}"));
|
let mut object = percent_decode(o.as_bytes())
|
||||||
|
.decode_utf8()
|
||||||
|
.unwrap()
|
||||||
|
.to_string();
|
||||||
|
|
||||||
|
object = path.fold(object, |o, p| {
|
||||||
|
format!(
|
||||||
|
"{o}/{}",
|
||||||
|
percent_decode(p.as_bytes()).decode_utf8().unwrap()
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
let mut q = url.query_pairs();
|
let mut q = url.query_pairs();
|
||||||
let v = q.next();
|
let v = q.next();
|
||||||
|
|
Loading…
Reference in a new issue