mirror of
https://github.com/minio/minio-rs.git
synced 2026-01-22 15:42:10 +08:00
list_objects(): fix user metadata as per MinIO server (#30)
Signed-off-by: Bala.FA <bala@minio.io>
This commit is contained in:
parent
67d92a3427
commit
f4cadad6ef
@ -12,7 +12,6 @@ urlencoding = "2.1.0"
|
||||
lazy_static = "1.4.0"
|
||||
regex = "1.5.6"
|
||||
chrono = "0.4.19"
|
||||
chrono_locale = "0.1.1"
|
||||
sha2 = "0.10.2"
|
||||
base64 = "0.13.0"
|
||||
md5 = "0.7.0"
|
||||
|
||||
@ -118,7 +118,7 @@ fn parse_list_objects_contents(
|
||||
is_delete_marker: bool,
|
||||
) -> Result<(), Error> {
|
||||
loop {
|
||||
let mut content = match root.take_child(tag) {
|
||||
let content = match root.take_child(tag) {
|
||||
Some(v) => v,
|
||||
None => break,
|
||||
};
|
||||
@ -142,15 +142,17 @@ fn parse_list_objects_contents(
|
||||
),
|
||||
None => (None, None),
|
||||
};
|
||||
let user_metadata = match content.get_mut_child("UserMetadata") {
|
||||
let user_metadata = match content.get_child("UserMetadata") {
|
||||
Some(v) => {
|
||||
let mut map: HashMap<String, String> = HashMap::new();
|
||||
loop {
|
||||
let item = match v.take_child("Items") {
|
||||
Some(v) => v,
|
||||
None => break,
|
||||
};
|
||||
map.insert(get_text(&item, "Key")?, get_text(&item, "Value")?);
|
||||
for xml_node in &v.children {
|
||||
let u = xml_node
|
||||
.as_element()
|
||||
.ok_or(Error::XmlError(format!("unable to convert to element")))?;
|
||||
map.insert(
|
||||
u.name.to_string(),
|
||||
u.get_text().unwrap_or_default().to_string(),
|
||||
);
|
||||
}
|
||||
Some(map)
|
||||
}
|
||||
|
||||
@ -16,8 +16,7 @@
|
||||
use crate::s3::error::Error;
|
||||
pub use base64::encode as b64encode;
|
||||
use byteorder::{BigEndian, ReadBytesExt};
|
||||
use chrono::{DateTime, NaiveDateTime, ParseError, Utc};
|
||||
use chrono_locale::LocaleDate;
|
||||
use chrono::{DateTime, Datelike, NaiveDateTime, ParseError, Utc};
|
||||
use crc::{Crc, CRC_32_ISO_HDLC};
|
||||
use lazy_static::lazy_static;
|
||||
use md5::compute as md5compute;
|
||||
@ -72,7 +71,27 @@ pub fn to_amz_date(time: UtcTime) -> String {
|
||||
}
|
||||
|
||||
pub fn to_http_header_value(time: UtcTime) -> String {
|
||||
time.formatl("%a, %d %b %Y %H:%M:%S GMT", "C").to_string()
|
||||
format!(
|
||||
"{}, {} {} {} GMT",
|
||||
time.weekday(),
|
||||
time.day(),
|
||||
match time.month() {
|
||||
1 => "Jan",
|
||||
2 => "Feb",
|
||||
3 => "Mar",
|
||||
4 => "Apr",
|
||||
5 => "May",
|
||||
6 => "Jun",
|
||||
7 => "Jul",
|
||||
8 => "Aug",
|
||||
9 => "Sep",
|
||||
10 => "Oct",
|
||||
11 => "Nov",
|
||||
12 => "Dec",
|
||||
_ => "",
|
||||
},
|
||||
time.format("%Y %H:%M:%S").to_string()
|
||||
)
|
||||
}
|
||||
|
||||
pub fn to_iso8601utc(time: UtcTime) -> String {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user