jorgehermo9 commented on code in PR #5274:
URL: https://github.com/apache/opendal/pull/5274#discussion_r1826554827


##########
core/src/raw/http_util/header.rs:
##########
@@ -189,6 +191,21 @@ pub fn parse_into_metadata(path: &str, headers: 
&HeaderMap) -> Result<Metadata>
     Ok(m)
 }
 
+/// Parse prefixed headers and return a map with the prefix of each header 
removed.
+pub fn parse_prefixed_headers(headers: &HeaderMap, prefix: &str) -> 
HashMap<String, String> {
+    headers
+        .iter()
+        .filter_map(|(name, value)| {
+            name.as_str().strip_prefix(prefix).and_then(|stripped_key| {
+                value
+                    .to_str()

Review Comment:
   I didn't use the `parse_header_to_str` as it was done in the `s3` user_meta 
implementation. I see that the `parse_header_to_str` was only useful in this 
case for the error handling of `value.to_str()`, but that error handling was 
being thrown away 
   
![image](https://github.com/user-attachments/assets/1217902a-10f6-41d1-b8f2-63d35a3cdc8b)
   
   Changed to this for simplicity sake.
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@opendal.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to