mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-11 23:56:53 +00:00
build(deps): bump s3s from 0.12.0-rc.4 to 0.12.0-rc.5 in the s3s group (#1046)
Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: loverustfs <hello@rustfs.com> Co-authored-by: houseme <housemecn@gmail.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: houseme <4829346+houseme@users.noreply.github.com>
This commit is contained in:
@@ -24,6 +24,7 @@ use http::{HeaderMap, HeaderValue, Uri};
|
||||
use hyper::StatusCode;
|
||||
use matchit::Params;
|
||||
use rustfs_common::heal_channel::HealOpts;
|
||||
use rustfs_config::{MAX_ADMIN_REQUEST_BODY_SIZE, MAX_HEAL_REQUEST_SIZE};
|
||||
use rustfs_ecstore::admin_server_info::get_server_info;
|
||||
use rustfs_ecstore::bucket::bucket_target_sys::BucketTargetSys;
|
||||
use rustfs_ecstore::bucket::metadata::BUCKET_TARGETS_FILE;
|
||||
@@ -860,11 +861,11 @@ impl Operation for HealHandler {
|
||||
let Some(cred) = req.credentials else { return Err(s3_error!(InvalidRequest, "get cred failed")) };
|
||||
info!("cred: {:?}", cred);
|
||||
let mut input = req.input;
|
||||
let bytes = match input.store_all_unlimited().await {
|
||||
let bytes = match input.store_all_limited(MAX_HEAL_REQUEST_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(InvalidRequest, "heal request body too large or failed to read"));
|
||||
}
|
||||
};
|
||||
info!("bytes: {:?}", bytes);
|
||||
@@ -1052,11 +1053,11 @@ impl Operation for SetRemoteTargetHandler {
|
||||
.map_err(ApiError::from)?;
|
||||
|
||||
let mut input = req.input;
|
||||
let body = match input.store_all_unlimited().await {
|
||||
let body = match input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(InvalidRequest, "remote target configuration body too large or failed to read"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -21,9 +21,9 @@ use crate::{
|
||||
admin::{auth::validate_admin_request, router::Operation},
|
||||
auth::{check_key_valid, get_session_token},
|
||||
};
|
||||
|
||||
use http::{HeaderMap, StatusCode};
|
||||
use matchit::Params;
|
||||
use rustfs_config::MAX_BUCKET_METADATA_IMPORT_SIZE;
|
||||
use rustfs_ecstore::{
|
||||
StorageAPI,
|
||||
bucket::{
|
||||
@@ -393,11 +393,11 @@ impl Operation for ImportBucketMetadata {
|
||||
.await?;
|
||||
|
||||
let mut input = req.input;
|
||||
let body = match input.store_all_unlimited().await {
|
||||
let body = match input.store_all_limited(MAX_BUCKET_METADATA_IMPORT_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(InvalidRequest, "bucket metadata import body too large or failed to read"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ use crate::auth::{check_key_valid, get_session_token};
|
||||
use http::{HeaderMap, StatusCode};
|
||||
use matchit::Params;
|
||||
use rustfs_config::notify::{NOTIFY_MQTT_SUB_SYS, NOTIFY_WEBHOOK_SUB_SYS};
|
||||
use rustfs_config::{ENABLE_KEY, EnableState};
|
||||
use rustfs_config::{ENABLE_KEY, EnableState, MAX_ADMIN_REQUEST_BODY_SIZE};
|
||||
use rustfs_targets::check_mqtt_broker_available;
|
||||
use s3s::header::CONTENT_LENGTH;
|
||||
use s3s::{Body, S3Error, S3ErrorCode, S3Request, S3Response, S3Result, header::CONTENT_TYPE, s3_error};
|
||||
@@ -140,7 +140,7 @@ impl Operation for NotificationTarget {
|
||||
|
||||
// 4. The parsing request body is KVS (Key-Value Store)
|
||||
let mut input = req.input;
|
||||
let body = input.store_all_unlimited().await.map_err(|e| {
|
||||
let body = input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await.map_err(|e| {
|
||||
warn!("failed to read request body: {:?}", e);
|
||||
s3_error!(InvalidRequest, "failed to read request body")
|
||||
})?;
|
||||
|
||||
@@ -12,8 +12,13 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
use crate::{
|
||||
admin::{auth::validate_admin_request, router::Operation, utils::has_space_be},
|
||||
auth::{check_key_valid, constant_time_eq, get_session_token},
|
||||
};
|
||||
use http::{HeaderMap, StatusCode};
|
||||
use matchit::Params;
|
||||
use rustfs_config::MAX_ADMIN_REQUEST_BODY_SIZE;
|
||||
use rustfs_ecstore::global::get_global_action_cred;
|
||||
use rustfs_iam::error::{is_err_no_such_group, is_err_no_such_user};
|
||||
use rustfs_madmin::GroupAddRemove;
|
||||
@@ -27,11 +32,6 @@ use serde::Deserialize;
|
||||
use serde_urlencoded::from_bytes;
|
||||
use tracing::warn;
|
||||
|
||||
use crate::{
|
||||
admin::{auth::validate_admin_request, router::Operation, utils::has_space_be},
|
||||
auth::{check_key_valid, constant_time_eq, get_session_token},
|
||||
};
|
||||
|
||||
#[derive(Debug, Deserialize, Default)]
|
||||
pub struct GroupQuery {
|
||||
pub group: String,
|
||||
@@ -213,11 +213,11 @@ impl Operation for UpdateGroupMembers {
|
||||
.await?;
|
||||
|
||||
let mut input = req.input;
|
||||
let body = match input.store_all_unlimited().await {
|
||||
let body = match input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(InvalidRequest, "group configuration body too large or failed to read"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ use crate::auth::{check_key_valid, get_session_token};
|
||||
use base64::Engine;
|
||||
use hyper::{HeaderMap, StatusCode};
|
||||
use matchit::Params;
|
||||
use rustfs_config::MAX_ADMIN_REQUEST_BODY_SIZE;
|
||||
use rustfs_kms::{get_global_encryption_service, types::*};
|
||||
use rustfs_policy::policy::action::{Action, AdminAction};
|
||||
use s3s::header::CONTENT_TYPE;
|
||||
@@ -131,7 +132,7 @@ impl Operation for CreateKeyHandler {
|
||||
|
||||
let body = req
|
||||
.input
|
||||
.store_all_unlimited()
|
||||
.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE)
|
||||
.await
|
||||
.map_err(|e| s3_error!(InvalidRequest, "failed to read request body: {}", e))?;
|
||||
|
||||
@@ -325,7 +326,7 @@ impl Operation for GenerateDataKeyHandler {
|
||||
|
||||
let body = req
|
||||
.input
|
||||
.store_all_unlimited()
|
||||
.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE)
|
||||
.await
|
||||
.map_err(|e| s3_error!(InvalidRequest, "failed to read request body: {}", e))?;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ use crate::admin::auth::validate_admin_request;
|
||||
use crate::auth::{check_key_valid, get_session_token};
|
||||
use hyper::StatusCode;
|
||||
use matchit::Params;
|
||||
use rustfs_config::MAX_ADMIN_REQUEST_BODY_SIZE;
|
||||
use rustfs_ecstore::config::com::{read_config, save_config};
|
||||
use rustfs_ecstore::new_object_layer_fn;
|
||||
use rustfs_kms::{
|
||||
@@ -102,7 +103,7 @@ impl Operation for ConfigureKmsHandler {
|
||||
|
||||
let body = req
|
||||
.input
|
||||
.store_all_unlimited()
|
||||
.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE)
|
||||
.await
|
||||
.map_err(|e| s3_error!(InvalidRequest, "failed to read request body: {}", e))?;
|
||||
|
||||
@@ -200,7 +201,7 @@ impl Operation for StartKmsHandler {
|
||||
|
||||
let body = req
|
||||
.input
|
||||
.store_all_unlimited()
|
||||
.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE)
|
||||
.await
|
||||
.map_err(|e| s3_error!(InvalidRequest, "failed to read request body: {}", e))?;
|
||||
|
||||
@@ -469,7 +470,7 @@ impl Operation for ReconfigureKmsHandler {
|
||||
|
||||
let body = req
|
||||
.input
|
||||
.store_all_unlimited()
|
||||
.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE)
|
||||
.await
|
||||
.map_err(|e| s3_error!(InvalidRequest, "failed to read request body: {}", e))?;
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ use crate::admin::auth::validate_admin_request;
|
||||
use crate::auth::{check_key_valid, get_session_token};
|
||||
use hyper::{HeaderMap, StatusCode};
|
||||
use matchit::Params;
|
||||
use rustfs_config::MAX_ADMIN_REQUEST_BODY_SIZE;
|
||||
use rustfs_kms::{KmsError, get_global_kms_service_manager, types::*};
|
||||
use rustfs_policy::policy::action::{Action, AdminAction};
|
||||
use s3s::header::CONTENT_TYPE;
|
||||
@@ -83,7 +84,7 @@ impl Operation for CreateKmsKeyHandler {
|
||||
|
||||
let body = req
|
||||
.input
|
||||
.store_all_unlimited()
|
||||
.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE)
|
||||
.await
|
||||
.map_err(|e| s3_error!(InvalidRequest, "failed to read request body: {}", e))?;
|
||||
|
||||
@@ -216,7 +217,7 @@ impl Operation for DeleteKmsKeyHandler {
|
||||
|
||||
let body = req
|
||||
.input
|
||||
.store_all_unlimited()
|
||||
.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE)
|
||||
.await
|
||||
.map_err(|e| s3_error!(InvalidRequest, "failed to read request body: {}", e))?;
|
||||
|
||||
@@ -364,7 +365,7 @@ impl Operation for CancelKmsKeyDeletionHandler {
|
||||
|
||||
let body = req
|
||||
.input
|
||||
.store_all_unlimited()
|
||||
.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE)
|
||||
.await
|
||||
.map_err(|e| s3_error!(InvalidRequest, "failed to read request body: {}", e))?;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ use crate::{
|
||||
};
|
||||
use http::{HeaderMap, StatusCode};
|
||||
use matchit::Params;
|
||||
use rustfs_config::MAX_ADMIN_REQUEST_BODY_SIZE;
|
||||
use rustfs_ecstore::global::get_global_action_cred;
|
||||
use rustfs_iam::error::is_err_no_such_user;
|
||||
use rustfs_iam::store::MappedPolicy;
|
||||
@@ -139,11 +140,11 @@ impl Operation for AddCannedPolicy {
|
||||
}
|
||||
|
||||
let mut input = req.input;
|
||||
let policy_bytes = match input.store_all_unlimited().await {
|
||||
let policy_bytes = match input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(InvalidRequest, "policy configuration body too large or failed to read"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ use crate::{admin::router::Operation, auth::check_key_valid};
|
||||
use http::HeaderMap;
|
||||
use hyper::StatusCode;
|
||||
use matchit::Params;
|
||||
use rustfs_config::MAX_ADMIN_REQUEST_BODY_SIZE;
|
||||
use rustfs_ecstore::global::get_global_action_cred;
|
||||
use rustfs_iam::error::is_err_no_such_service_account;
|
||||
use rustfs_iam::sys::{NewServiceAccountOpts, UpdateServiceAccountOpts};
|
||||
@@ -48,11 +49,14 @@ impl Operation for AddServiceAccount {
|
||||
check_key_valid(get_session_token(&req.uri, &req.headers).unwrap_or_default(), &req_cred.access_key).await?;
|
||||
|
||||
let mut input = req.input;
|
||||
let body = match input.store_all_unlimited().await {
|
||||
let body = match input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(
|
||||
InvalidRequest,
|
||||
"service account configuration body too large or failed to read"
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -235,11 +239,14 @@ impl Operation for UpdateServiceAccount {
|
||||
// })?;
|
||||
|
||||
let mut input = req.input;
|
||||
let body = match input.store_all_unlimited().await {
|
||||
let body = match input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(
|
||||
InvalidRequest,
|
||||
"service account configuration body too large or failed to read"
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -439,8 +446,8 @@ impl Operation for ListServiceAccount {
|
||||
|
||||
let query = {
|
||||
if let Some(query) = req.uri.query() {
|
||||
let input: ListServiceAccountQuery =
|
||||
from_bytes(query.as_bytes()).map_err(|_e| s3_error!(InvalidArgument, "get body failed"))?;
|
||||
let input: ListServiceAccountQuery = from_bytes(query.as_bytes())
|
||||
.map_err(|_e| s3_error!(InvalidArgument, "invalid service account query parameters"))?;
|
||||
input
|
||||
} else {
|
||||
ListServiceAccountQuery::default()
|
||||
@@ -549,8 +556,8 @@ impl Operation for DeleteServiceAccount {
|
||||
|
||||
let query = {
|
||||
if let Some(query) = req.uri.query() {
|
||||
let input: AccessKeyQuery =
|
||||
from_bytes(query.as_bytes()).map_err(|_e| s3_error!(InvalidArgument, "get body failed"))?;
|
||||
let input: AccessKeyQuery = from_bytes(query.as_bytes())
|
||||
.map_err(|_e| s3_error!(InvalidArgument, "invalid access key query parameters"))?;
|
||||
input
|
||||
} else {
|
||||
AccessKeyQuery::default()
|
||||
|
||||
@@ -18,6 +18,7 @@ use crate::{
|
||||
};
|
||||
use http::StatusCode;
|
||||
use matchit::Params;
|
||||
use rustfs_config::MAX_ADMIN_REQUEST_BODY_SIZE;
|
||||
use rustfs_ecstore::bucket::utils::serialize;
|
||||
use rustfs_iam::{manager::get_token_signing_key, sys::SESSION_POLICY_NAME};
|
||||
use rustfs_policy::{auth::get_new_credentials_with_metadata, policy::Policy};
|
||||
@@ -71,15 +72,15 @@ impl Operation for AssumeRoleHandle {
|
||||
|
||||
let mut input = req.input;
|
||||
|
||||
let bytes = match input.store_all_unlimited().await {
|
||||
let bytes = match input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(InvalidRequest, "STS request body too large or failed to read"));
|
||||
}
|
||||
};
|
||||
|
||||
let body: AssumeRoleRequest = from_bytes(&bytes).map_err(|_e| s3_error!(InvalidRequest, "get body failed"))?;
|
||||
let body: AssumeRoleRequest = from_bytes(&bytes).map_err(|_e| s3_error!(InvalidRequest, "invalid STS request format"))?;
|
||||
|
||||
if body.action.as_str() != ASSUME_ROLE_ACTION {
|
||||
return Err(s3_error!(InvalidArgument, "not support action"));
|
||||
|
||||
@@ -13,24 +13,13 @@
|
||||
// limitations under the License.
|
||||
#![allow(unused_variables, unused_mut, unused_must_use)]
|
||||
|
||||
use http::{HeaderMap, StatusCode};
|
||||
//use iam::get_global_action_cred;
|
||||
use matchit::Params;
|
||||
use rustfs_policy::policy::action::{Action, AdminAction};
|
||||
use s3s::{
|
||||
Body, S3Error, S3ErrorCode, S3Request, S3Response, S3Result,
|
||||
header::{CONTENT_LENGTH, CONTENT_TYPE},
|
||||
s3_error,
|
||||
};
|
||||
use serde_urlencoded::from_bytes;
|
||||
use time::OffsetDateTime;
|
||||
use tracing::{debug, warn};
|
||||
|
||||
use crate::{
|
||||
admin::{auth::validate_admin_request, router::Operation},
|
||||
auth::{check_key_valid, get_session_token},
|
||||
};
|
||||
|
||||
use http::{HeaderMap, StatusCode};
|
||||
use matchit::Params;
|
||||
use rustfs_config::MAX_ADMIN_REQUEST_BODY_SIZE;
|
||||
use rustfs_ecstore::{
|
||||
config::storageclass,
|
||||
global::GLOBAL_TierConfigMgr,
|
||||
@@ -44,6 +33,15 @@ use rustfs_ecstore::{
|
||||
},
|
||||
},
|
||||
};
|
||||
use rustfs_policy::policy::action::{Action, AdminAction};
|
||||
use s3s::{
|
||||
Body, S3Error, S3ErrorCode, S3Request, S3Response, S3Result,
|
||||
header::{CONTENT_LENGTH, CONTENT_TYPE},
|
||||
s3_error,
|
||||
};
|
||||
use serde_urlencoded::from_bytes;
|
||||
use time::OffsetDateTime;
|
||||
use tracing::{debug, warn};
|
||||
|
||||
#[derive(Debug, Clone, serde::Deserialize, Default)]
|
||||
pub struct AddTierQuery {
|
||||
@@ -95,11 +93,11 @@ impl Operation for AddTier {
|
||||
validate_admin_request(&req.headers, &cred, owner, false, vec![Action::AdminAction(AdminAction::SetTierAction)]).await?;
|
||||
|
||||
let mut input = req.input;
|
||||
let body = match input.store_all_unlimited().await {
|
||||
let body = match input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(InvalidRequest, "tier configuration body too large or failed to read"));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -223,11 +221,11 @@ impl Operation for EditTier {
|
||||
validate_admin_request(&req.headers, &cred, owner, false, vec![Action::AdminAction(AdminAction::SetTierAction)]).await?;
|
||||
|
||||
let mut input = req.input;
|
||||
let body = match input.store_all_unlimited().await {
|
||||
let body = match input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(InvalidRequest, "tier configuration body too large or failed to read"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ use crate::{
|
||||
};
|
||||
use http::{HeaderMap, StatusCode};
|
||||
use matchit::Params;
|
||||
use rustfs_config::{MAX_ADMIN_REQUEST_BODY_SIZE, MAX_IAM_IMPORT_SIZE};
|
||||
use rustfs_ecstore::global::get_global_action_cred;
|
||||
use rustfs_iam::{
|
||||
store::{GroupInfo, MappedPolicy, UserType},
|
||||
@@ -76,7 +77,7 @@ impl Operation for AddUser {
|
||||
}
|
||||
|
||||
let mut input = req.input;
|
||||
let body = match input.store_all_unlimited().await {
|
||||
let body = match input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
@@ -636,7 +637,7 @@ impl Operation for ImportIam {
|
||||
.await?;
|
||||
|
||||
let mut input = req.input;
|
||||
let body = match input.store_all_unlimited().await {
|
||||
let body = match input.store_all_limited(MAX_IAM_IMPORT_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
|
||||
@@ -19,6 +19,7 @@ use futures::StreamExt;
|
||||
use http::StatusCode;
|
||||
use hyper::Method;
|
||||
use matchit::Params;
|
||||
use rustfs_config::MAX_ADMIN_REQUEST_BODY_SIZE;
|
||||
use rustfs_ecstore::disk::DiskAPI;
|
||||
use rustfs_ecstore::disk::WalkDirOptions;
|
||||
use rustfs_ecstore::set_disk::DEFAULT_READ_BUFFER_SIZE;
|
||||
@@ -141,11 +142,11 @@ impl Operation for WalkDir {
|
||||
};
|
||||
|
||||
let mut input = req.input;
|
||||
let body = match input.store_all_unlimited().await {
|
||||
let body = match input.store_all_limited(MAX_ADMIN_REQUEST_BODY_SIZE).await {
|
||||
Ok(b) => b,
|
||||
Err(e) => {
|
||||
warn!("get body failed, e: {:?}", e);
|
||||
return Err(s3_error!(InvalidRequest, "get body failed"));
|
||||
return Err(s3_error!(InvalidRequest, "RPC request body too large or failed to read"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+35
-15
@@ -2389,8 +2389,10 @@ impl S3 for FS {
|
||||
let info = store.get_object_info(&bucket, &key, &opts).await.map_err(ApiError::from)?;
|
||||
|
||||
if let Some(match_etag) = if_none_match {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag == match_etag.as_str()) {
|
||||
return Err(S3Error::new(S3ErrorCode::NotModified));
|
||||
if let Some(strong_etag) = match_etag.as_strong() {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag == strong_etag) {
|
||||
return Err(S3Error::new(S3ErrorCode::NotModified));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2405,8 +2407,10 @@ impl S3 for FS {
|
||||
}
|
||||
|
||||
if let Some(match_etag) = if_match {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag != match_etag.as_str()) {
|
||||
return Err(S3Error::new(S3ErrorCode::PreconditionFailed));
|
||||
if let Some(strong_etag) = match_etag.as_strong() {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag != strong_etag) {
|
||||
return Err(S3Error::new(S3ErrorCode::PreconditionFailed));
|
||||
}
|
||||
}
|
||||
} else if let Some(unmodified_since) = if_unmodified_since {
|
||||
if info.mod_time.is_some_and(|mod_time| {
|
||||
@@ -2856,13 +2860,17 @@ impl S3 for FS {
|
||||
Ok(info) => {
|
||||
if !info.delete_marker {
|
||||
if let Some(ifmatch) = if_match {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag != ifmatch.as_str()) {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
if let Some(strong_etag) = ifmatch.as_strong() {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag != strong_etag) {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(ifnonematch) = if_none_match {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag == ifnonematch.as_str()) {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
if let Some(strong_etag) = ifnonematch.as_strong() {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag == strong_etag) {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3655,7 +3663,12 @@ impl S3 for FS {
|
||||
// Validate copy conditions (simplified for now)
|
||||
if let Some(if_match) = copy_source_if_match {
|
||||
if let Some(ref etag) = src_info.etag {
|
||||
if etag != &if_match {
|
||||
if let Some(strong_etag) = if_match.as_strong() {
|
||||
if etag != strong_etag {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
}
|
||||
} else {
|
||||
// Weak ETag in If-Match should fail
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
}
|
||||
} else {
|
||||
@@ -3665,9 +3678,12 @@ impl S3 for FS {
|
||||
|
||||
if let Some(if_none_match) = copy_source_if_none_match {
|
||||
if let Some(ref etag) = src_info.etag {
|
||||
if etag == &if_none_match {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
if let Some(strong_etag) = if_none_match.as_strong() {
|
||||
if etag == strong_etag {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
}
|
||||
}
|
||||
// Weak ETag in If-None-Match is ignored (doesn't match)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3939,13 +3955,17 @@ impl S3 for FS {
|
||||
Ok(info) => {
|
||||
if !info.delete_marker {
|
||||
if let Some(ifmatch) = if_match {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag != ifmatch.as_str()) {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
if let Some(strong_etag) = ifmatch.as_strong() {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag != strong_etag) {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(ifnonematch) = if_none_match {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag == ifnonematch.as_str()) {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
if let Some(strong_etag) = ifnonematch.as_strong() {
|
||||
if info.etag.as_ref().is_some_and(|etag| etag == strong_etag) {
|
||||
return Err(s3_error!(PreconditionFailed));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user