mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-22 12:26:37 +00:00
fix:Fix some errors tested in mint (#507)
* refactor: replace new_object_layer_fn with get_validated_store for bucket validation * feat: add validation for object tagging limits and uniqueness * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: add EntityTooSmall error for multipart uploads and update error handling * feat: validate max_parts input range for S3 multipart uploads * Update rustfs/src/storage/ecfs.rs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: optimize tag key and value length validation checks --------- Co-authored-by: damon <damonxue2@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -148,6 +148,9 @@ pub enum StorageError {
|
||||
#[error("Specified part could not be found. PartNumber {0}, Expected {1}, got {2}")]
|
||||
InvalidPart(usize, String, String),
|
||||
|
||||
#[error("Your proposed upload is smaller than the minimum allowed size. Part {0} size {1} is less than minimum {2}")]
|
||||
EntityTooSmall(usize, i64, i64),
|
||||
|
||||
#[error("Invalid version id: {0}/{1}-{2}")]
|
||||
InvalidVersionID(String, String, String),
|
||||
#[error("invalid data movement operation, source and destination pool are the same for : {0}/{1}-{2}")]
|
||||
@@ -408,6 +411,7 @@ impl Clone for StorageError {
|
||||
// StorageError::InsufficientWriteQuorum => StorageError::InsufficientWriteQuorum,
|
||||
StorageError::DecommissionNotStarted => StorageError::DecommissionNotStarted,
|
||||
StorageError::InvalidPart(a, b, c) => StorageError::InvalidPart(*a, b.clone(), c.clone()),
|
||||
StorageError::EntityTooSmall(a, b, c) => StorageError::EntityTooSmall(*a, *b, *c),
|
||||
StorageError::DoneForNow => StorageError::DoneForNow,
|
||||
StorageError::DecommissionAlreadyRunning => StorageError::DecommissionAlreadyRunning,
|
||||
StorageError::ErasureReadQuorum => StorageError::ErasureReadQuorum,
|
||||
@@ -486,6 +490,7 @@ impl StorageError {
|
||||
StorageError::InsufficientReadQuorum(_, _) => 0x39,
|
||||
StorageError::InsufficientWriteQuorum(_, _) => 0x3A,
|
||||
StorageError::PreconditionFailed => 0x3B,
|
||||
StorageError::EntityTooSmall(_, _, _) => 0x3C,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5268,10 +5268,16 @@ impl StorageAPI for SetDisks {
|
||||
|
||||
if (i < uploaded_parts.len() - 1) && !is_min_allowed_part_size(ext_part.actual_size) {
|
||||
error!(
|
||||
"complete_multipart_upload is_min_allowed_part_size err {:?}, part_id={}, bucket={}, object={}",
|
||||
ext_part.actual_size, p.part_num, bucket, object
|
||||
"complete_multipart_upload part size too small: part {} size {} is less than minimum {}",
|
||||
p.part_num,
|
||||
ext_part.actual_size,
|
||||
GLOBAL_MIN_PART_SIZE.as_u64()
|
||||
);
|
||||
return Err(Error::InvalidPart(p.part_num, ext_part.etag.clone(), p.etag.clone().unwrap_or_default()));
|
||||
return Err(Error::EntityTooSmall(
|
||||
p.part_num,
|
||||
ext_part.actual_size,
|
||||
GLOBAL_MIN_PART_SIZE.as_u64() as i64,
|
||||
));
|
||||
}
|
||||
|
||||
object_size += ext_part.size;
|
||||
|
||||
Reference in New Issue
Block a user