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"
|
lazy_static = "1.4.0"
|
||||||
regex = "1.5.6"
|
regex = "1.5.6"
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
chrono_locale = "0.1.1"
|
|
||||||
sha2 = "0.10.2"
|
sha2 = "0.10.2"
|
||||||
base64 = "0.13.0"
|
base64 = "0.13.0"
|
||||||
md5 = "0.7.0"
|
md5 = "0.7.0"
|
||||||
|
|||||||
@ -118,7 +118,7 @@ fn parse_list_objects_contents(
|
|||||||
is_delete_marker: bool,
|
is_delete_marker: bool,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
loop {
|
loop {
|
||||||
let mut content = match root.take_child(tag) {
|
let content = match root.take_child(tag) {
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
None => break,
|
None => break,
|
||||||
};
|
};
|
||||||
@ -142,15 +142,17 @@ fn parse_list_objects_contents(
|
|||||||
),
|
),
|
||||||
None => (None, None),
|
None => (None, None),
|
||||||
};
|
};
|
||||||
let user_metadata = match content.get_mut_child("UserMetadata") {
|
let user_metadata = match content.get_child("UserMetadata") {
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
let mut map: HashMap<String, String> = HashMap::new();
|
let mut map: HashMap<String, String> = HashMap::new();
|
||||||
loop {
|
for xml_node in &v.children {
|
||||||
let item = match v.take_child("Items") {
|
let u = xml_node
|
||||||
Some(v) => v,
|
.as_element()
|
||||||
None => break,
|
.ok_or(Error::XmlError(format!("unable to convert to element")))?;
|
||||||
};
|
map.insert(
|
||||||
map.insert(get_text(&item, "Key")?, get_text(&item, "Value")?);
|
u.name.to_string(),
|
||||||
|
u.get_text().unwrap_or_default().to_string(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
Some(map)
|
Some(map)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,7 @@
|
|||||||
use crate::s3::error::Error;
|
use crate::s3::error::Error;
|
||||||
pub use base64::encode as b64encode;
|
pub use base64::encode as b64encode;
|
||||||
use byteorder::{BigEndian, ReadBytesExt};
|
use byteorder::{BigEndian, ReadBytesExt};
|
||||||
use chrono::{DateTime, NaiveDateTime, ParseError, Utc};
|
use chrono::{DateTime, Datelike, NaiveDateTime, ParseError, Utc};
|
||||||
use chrono_locale::LocaleDate;
|
|
||||||
use crc::{Crc, CRC_32_ISO_HDLC};
|
use crc::{Crc, CRC_32_ISO_HDLC};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use md5::compute as md5compute;
|
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 {
|
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 {
|
pub fn to_iso8601utc(time: UtcTime) -> String {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user