fix: when the Object Lock configuration does not exist, an error message should be returned (#771) (#798)

fix: when the Object Lock configuration does not exist, an error message should be returned (#771) (#798)
This commit is contained in:
shiro.lee
2025-11-05 23:48:54 +08:00
committed by GitHub
parent 1b22a1e078
commit 8203f9ff6f

View File

@@ -4160,6 +4160,13 @@ impl S3 for FS {
let object_lock_configuration = match metadata_sys::get_object_lock_config(&bucket).await {
Ok((cfg, _created)) => Some(cfg),
Err(err) => {
if err == StorageError::ConfigNotFound {
return Err(S3Error::with_message(
S3ErrorCode::ObjectLockConfigurationNotFoundError,
"Object Lock configuration does not exist for this bucket".to_string(),
));
}
debug!("get_object_lock_config err {:?}", err);
None
}