mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-31 09:18:28 +00:00
Fix/response (#485)
* fix:list_parts response * fix:list_objects skip delete_marker
This commit is contained in:
@@ -1003,7 +1003,7 @@ async fn gather_results(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !opts.incl_deleted && entry.is_object() && entry.is_latest_delete_marker() && entry.is_object_dir() {
|
if !opts.incl_deleted && entry.is_object() && entry.is_latest_delete_marker() && !entry.is_object_dir() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -112,6 +112,39 @@ impl FileMeta {
|
|||||||
Ok((&buf[8..], major, minor))
|
Ok((&buf[8..], major, minor))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns (meta, inline_data)
|
||||||
|
pub fn is_indexed_meta(buf: &[u8]) -> Result<(&[u8], &[u8])> {
|
||||||
|
let (buf, major, minor) = Self::check_xl2_v1(buf)?;
|
||||||
|
if major != 1 || minor < 3 {
|
||||||
|
return Ok((&[], &[]));
|
||||||
|
}
|
||||||
|
|
||||||
|
let (mut size_buf, buf) = buf.split_at(5);
|
||||||
|
|
||||||
|
// Get meta data, buf = crc + data
|
||||||
|
let bin_len = rmp::decode::read_bin_len(&mut size_buf)?;
|
||||||
|
|
||||||
|
if buf.len() < bin_len as usize {
|
||||||
|
return Ok((&[], &[]));
|
||||||
|
}
|
||||||
|
let (meta, buf) = buf.split_at(bin_len as usize);
|
||||||
|
|
||||||
|
if buf.len() < 5 {
|
||||||
|
return Err(Error::other("insufficient data for CRC"));
|
||||||
|
}
|
||||||
|
let (mut crc_buf, inline_data) = buf.split_at(5);
|
||||||
|
|
||||||
|
// crc check
|
||||||
|
let crc = rmp::decode::read_u32(&mut crc_buf)?;
|
||||||
|
let meta_crc = xxh64::xxh64(meta, XXHASH_SEED) as u32;
|
||||||
|
|
||||||
|
if crc != meta_crc {
|
||||||
|
return Err(Error::other("xl file crc check failed"));
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok((meta, inline_data))
|
||||||
|
}
|
||||||
|
|
||||||
// Fixed u32
|
// Fixed u32
|
||||||
pub fn read_bytes_header(buf: &[u8]) -> Result<(u32, &[u8])> {
|
pub fn read_bytes_header(buf: &[u8]) -> Result<(u32, &[u8])> {
|
||||||
let (mut size_buf, _) = buf.split_at(5);
|
let (mut size_buf, _) = buf.split_at(5);
|
||||||
@@ -289,6 +322,7 @@ impl FileMeta {
|
|||||||
|
|
||||||
let offset = wr.len();
|
let offset = wr.len();
|
||||||
|
|
||||||
|
// xl header
|
||||||
rmp::encode::write_uint8(&mut wr, XL_HEADER_VERSION)?;
|
rmp::encode::write_uint8(&mut wr, XL_HEADER_VERSION)?;
|
||||||
rmp::encode::write_uint8(&mut wr, XL_META_VERSION)?;
|
rmp::encode::write_uint8(&mut wr, XL_META_VERSION)?;
|
||||||
|
|
||||||
|
|||||||
@@ -112,8 +112,8 @@ impl MetaCacheEntry {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
match FileMeta::check_xl2_v1(&self.metadata) {
|
match FileMeta::is_indexed_meta(&self.metadata) {
|
||||||
Ok((meta, _, _)) => {
|
Ok((meta, _inline_data)) => {
|
||||||
if !meta.is_empty() {
|
if !meta.is_empty() {
|
||||||
return FileMeta::is_latest_delete_marker(meta);
|
return FileMeta::is_latest_delete_marker(meta);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1895,6 +1895,11 @@ impl S3 for FS {
|
|||||||
})
|
})
|
||||||
.collect(),
|
.collect(),
|
||||||
),
|
),
|
||||||
|
owner: Some(RUSTFS_OWNER.to_owned()),
|
||||||
|
initiator: Some(Initiator {
|
||||||
|
id: RUSTFS_OWNER.id.clone(),
|
||||||
|
display_name: RUSTFS_OWNER.display_name.clone(),
|
||||||
|
}),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
Ok(S3Response::new(output))
|
Ok(S3Response::new(output))
|
||||||
|
|||||||
Reference in New Issue
Block a user