@@ -10,7 +10,7 @@ use crate::state::State as AppState;
|
||||
|
||||
fn is_valid_bucket_name(name: &str) -> bool {
|
||||
let len = name.len();
|
||||
if len < 3 || len > 63 {
|
||||
if !(3..=63).contains(&len) {
|
||||
return false;
|
||||
}
|
||||
// Must contain only lowercase letters, numbers, hyphens, and periods
|
||||
@@ -30,11 +30,7 @@ fn is_valid_bucket_name(name: &str) -> bool {
|
||||
return false;
|
||||
}
|
||||
// Must not be formatted as an IP address
|
||||
if name.split('.').count() == 4
|
||||
&& name
|
||||
.split('.')
|
||||
.all(|part| part.parse::<u8>().is_ok())
|
||||
{
|
||||
if name.split('.').count() == 4 && name.split('.').all(|part| part.parse::<u8>().is_ok()) {
|
||||
return false;
|
||||
}
|
||||
true
|
||||
@@ -166,10 +162,7 @@ pub async fn list_buckets<B: StorageBackend>(
|
||||
StatusCode::OK,
|
||||
[
|
||||
("Content-Type", "application/xml".to_string()),
|
||||
(
|
||||
"x-amz-request-id",
|
||||
uuid::Uuid::new_v4().to_string(),
|
||||
),
|
||||
("x-amz-request-id", uuid::Uuid::new_v4().to_string()),
|
||||
],
|
||||
responses::list_buckets_xml(&buckets),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user