Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sdroege/gst-plugin-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <arun@asymptotic.io>2023-09-21 21:21:16 +0300
committerSebastian Dröge <sebastian@centricular.com>2023-11-10 18:47:41 +0300
commitd35fc2eb6d6853571d3d7e242a0ec84d81a9962f (patch)
tree232c5866a3baed720fb2b5350894985db9ee7fcd
parent8f97d691e1ff195308200e5b4c09a10450ff3f7b (diff)
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/1387>
-rw-r--r--net/aws/src/s3url.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/aws/src/s3url.rs b/net/aws/src/s3url.rs
index 3d601aed..54808af8 100644
--- a/net/aws/src/s3url.rs
+++ b/net/aws/src/s3url.rs
@@ -83,15 +83,21 @@ pub fn parse_s3_url(url_str: &str) -> Result<GstS3Url, String> {
.next()
.ok_or_else(|| format!("Invalid empty object/bucket '{}'", url))?;
+ if o.is_empty() {
+ return Err(format!("Invalid empty object/bucket '{}'", url));
+ }
+
let mut object = percent_decode(o.as_bytes())
.decode_utf8()
.unwrap()
.to_string();
- if o.is_empty() {
- return Err(format!("Invalid empty object/bucket '{}'", url));
- }
- object = path.fold(object, |o, p| format!("{}/{}", o, p));
+ object = path.fold(object, |o, p| {
+ format!(
+ "{o}/{}",
+ percent_decode(p.as_bytes()).decode_utf8().unwrap()
+ )
+ });
let mut q = url.query_pairs();
let v = q.next();